| 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.ui; |
| 17 | |
| 18 | import junit.framework.TestCase; |
| 19 | import net.sf.jomic.tools.TestTools; |
| 20 | |
| 21 | /** |
| 22 | * TestCase for GoToPageDialog. |
| 23 | * |
| 24 | * @author Thomas Aglassinger |
| 25 | */ |
| 26 | public class GoToPageDialogTest extends TestCase |
| 27 | { |
| 28 | private TestTools testTools; |
| 29 | |
| 30 | protected void setUp() |
| 31 | throws Exception { |
| 32 | super.setUp(); |
| 33 | testTools = TestTools.instance(); |
| 34 | testTools.setupCache(); |
| 35 | } |
| 36 | |
| 37 | public void testGoToPageDialog() { |
| 38 | JomicFrame frame = new JomicFrame(); |
| 39 | |
| 40 | try { |
| 41 | frame.pack(); |
| 42 | frame.setSize(TestTools.FRAME_WIDTH, TestTools.FRAME_HEIGHT); |
| 43 | frame.validate(); |
| 44 | frame.openSynchronously(testTools.getTestComicFile()); |
| 45 | |
| 46 | GoToPageDialog dialog = new GoToPageDialog(frame); |
| 47 | |
| 48 | try { |
| 49 | dialog.pack(); |
| 50 | // Note: Because of setModal(false), the dialog will not close when the Ok or |
| 51 | // Cancel button is pressed. |
| 52 | dialog.setModal(false); |
| 53 | dialog.setVisible(true); |
| 54 | testTools.waitSomeTime(); |
| 55 | dialog.setVisible(false); |
| 56 | } finally { |
| 57 | dialog.dispose(); |
| 58 | } |
| 59 | } finally { |
| 60 | frame.dispose(); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | protected void tearDown() |
| 65 | throws Exception { |
| 66 | testTools = null; |
| 67 | super.tearDown(); |
| 68 | } |
| 69 | } |