| 1 | // Jomic - a viewer for comic book archives. | 
| 2 | // Copyright (C) 2004-2011 Thomas Aglassinger | 
| 3 | // | 
| 4 | // This program is free software: you can redistribute it and/or modify | 
| 5 | // it under the terms of the GNU General Public License as published by | 
| 6 | // the Free Software Foundation, either version 3 of the License, or | 
| 7 | // (at your option) any later version. | 
| 8 | // | 
| 9 | // This program is distributed in the hope that it will be useful, | 
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12 | // GNU General Public License for more details. | 
| 13 | // | 
| 14 | // You should have received a copy of the GNU General Public License | 
| 15 | // along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
| 16 | package net.sf.jomic.comic; | 
| 17 |   | 
| 18 | import javax.swing.JCheckBox; | 
| 19 | import javax.swing.JTextField; | 
| 20 |   | 
| 21 | import junit.extensions.abbot.ComponentTestFixture; | 
| 22 | import net.sf.jomic.tools.TestTools; | 
| 23 | import abbot.finder.matchers.ClassMatcher; | 
| 24 |   | 
| 25 | /** | 
| 26 |  *  TestCase for ConversionBean. | 
| 27 |  * | 
| 28 |  * @author    Thomas Aglassinger | 
| 29 |  */ | 
| 30 | public class ConversionBeanTest extends ComponentTestFixture | 
| 31 | { | 
| 32 |     private TestTools testTools; | 
| 33 |   | 
| 34 |     protected void setUp() | 
| 35 |         throws Exception { | 
| 36 |         super.setUp(); | 
| 37 |         testTools = TestTools.instance(); | 
| 38 |     } | 
| 39 |   | 
| 40 |     public void testDisabledImageSizeLimit() | 
| 41 |         throws Exception { | 
| 42 |         ConversionBean bean = new ConversionBean(); | 
| 43 |   | 
| 44 |         showFrame(bean); | 
| 45 |   | 
| 46 |         JCheckBox limitPageSizeCheckBox = (JCheckBox) getFinder(). | 
| 47 |                 find(new ClassMatcher(JCheckBox.class)); | 
| 48 |         JTextField maxImageWidthFieldField = (JTextField) getFinder(). | 
| 49 |                 find(new ClassMatcher(JTextField.class)); | 
| 50 |   | 
| 51 |         assertFalse(limitPageSizeCheckBox.isSelected()); | 
| 52 |         assertFalse(maxImageWidthFieldField.isEnabled()); | 
| 53 |         limitPageSizeCheckBox.doClick(); | 
| 54 |   | 
| 55 |         assertTrue(limitPageSizeCheckBox.isSelected()); | 
| 56 |         assertTrue(maxImageWidthFieldField.isEnabled()); | 
| 57 |     } | 
| 58 |   | 
| 59 |     public void testUi() { | 
| 60 |         ConversionBean bean = new ConversionBean(); | 
| 61 |   | 
| 62 |         showFrame(bean); | 
| 63 |         testTools.waitSomeTime(); | 
| 64 |     } | 
| 65 |   | 
| 66 |     protected void tearDown() | 
| 67 |         throws Exception { | 
| 68 |         testTools = null; | 
| 69 |         super.tearDown(); | 
| 70 |     } | 
| 71 | } |