JAL-3949 - refactor logging from jalview.bin.Cache to jalview.bin.Console
[jalview.git] / test / jalview / gui / JAL1353bugdemo.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.gui;
22
23 import java.awt.Dimension;
24 import java.awt.event.MouseAdapter;
25 import java.awt.event.MouseEvent;
26
27 import javax.swing.JDesktopPane;
28 import javax.swing.JFrame;
29 import javax.swing.JInternalFrame;
30 import javax.swing.JTextArea;
31
32 import org.testng.annotations.AfterClass;
33 import org.testng.annotations.BeforeClass;
34 import org.testng.annotations.Test;
35
36 import jalview.bin.Console;
37
38 public class JAL1353bugdemo
39 {
40
41   @BeforeClass(alwaysRun = true)
42   public void setUpJvOptionPane()
43   {
44     JvOptionPane.setInteractiveMode(false);
45     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
46   }
47
48   @BeforeClass(alwaysRun = true)
49   public static void setUpBeforeClass() throws Exception
50   {
51   }
52
53   @AfterClass(alwaysRun = true)
54   public static void tearDownAfterClass() throws Exception
55   {
56   }
57
58   volatile boolean finish = false;
59
60   @Test(groups = { "Functional" }, enabled = false)
61   public void test()
62   {
63     Console.initLogger();
64     // final Desktop foo = new Desktop();
65     final JFrame cfoo = new JFrame("Crash Java");
66     final JDesktopPane foo = new JDesktopPane();
67     foo.setPreferredSize(new Dimension(600, 800));
68     cfoo.setSize(600, 800);
69     final JInternalFrame cont = new JInternalFrame("My Frame");
70     cont.setPreferredSize(new Dimension(400, 400));
71     String msg = "This is a dummy string. See the dummy string go.\n";
72     msg += msg; // 2
73     msg += msg; // 4
74     msg += msg; // 8
75     msg += msg; // 16
76     JTextArea evt = new JTextArea(
77             "Click here and drag text over this window to freeze java.\n\n"
78                     + msg);
79     cont.add(evt);
80     cont.pack();
81     foo.add("A frame", cont);
82     foo.setVisible(true);
83     foo.setEnabled(true);
84     foo.doLayout();
85     cfoo.add(foo);
86     // final JMenu jm = new JMenu("Do");
87     // JMenuItem jmi = new JMenuItem("this");
88     // jm.add(jmi);
89     evt.addMouseListener(new MouseAdapter()
90     {
91
92       @Override
93       public void mouseClicked(MouseEvent e)
94       {
95         // JFrame parent = new JFrame();
96         // parent.setBounds(foo.getBounds());
97         // JPanel oo = new JPanel();
98         // parent.add(oo);
99         // oo.setVisible(true);
100         // parent.setVisible(true);
101         EditNameDialog end = new EditNameDialog("Sequence Name",
102                         "Try and drag between the two text fields", "label 1", "Label 2");// );cont.getRootPane());
103         assert (end != null);
104         finish = true;
105       }
106     });
107     cont.setVisible(true);
108
109     // jmi.addActionListener(new ActionListener()
110     // {
111     //
112     // @Override
113     // public void actionPerformed(ActionEvent arg0)
114     // {
115     // EditNameDialog end = new EditNameDialog("Sequence Name",
116     // "Sequence Description", "label 1", "Label 2",
117     // "Try and drag between the two text fields", cont);
118     // assert (end != null);
119     // finish = true;
120     // }
121     // });
122     foo.setVisible(true);
123     cfoo.setVisible(true);
124     while (!finish)
125     {
126       try
127       {
128         Thread.sleep(100);
129       } catch (InterruptedException x)
130       {
131       }
132     }
133   }
134
135 }