25 |
* |
* |
26 |
* Contributors: |
* Contributors: |
27 |
* Martin O. J. Schmitz - initial API and implementation |
* Martin O. J. Schmitz - initial API and implementation |
28 |
* Stefan A. Krüger - additional utility classes |
* Stefan A. Tzeggai - additional utility classes |
29 |
******************************************************************************/ |
******************************************************************************/ |
30 |
package skrueger.i8n; |
package skrueger.i8n; |
31 |
|
|
32 |
import java.util.ArrayList; |
import java.util.ArrayList; |
33 |
|
|
34 |
|
import junit.framework.TestCase; |
35 |
|
|
36 |
import org.junit.Test; |
import org.junit.Test; |
37 |
|
|
38 |
import junit.framework.TestCase; |
import schmitzm.swing.TestingUtil; |
39 |
|
|
40 |
public class SwitchLanguageDialogTest extends TestCase { |
public class SwitchLanguageDialogTest extends TestCase { |
41 |
|
|
42 |
public void testDialog() { |
@Test |
43 |
ArrayList<String> langsa = new ArrayList<String>(); |
public void testDialog() throws Throwable { |
44 |
langsa.add("fr"); |
|
45 |
langsa.add("tr"); |
if (!TestingUtil.isInteractive()) |
46 |
// INteractive test diabled |
// Test needed here because following GUI creation would crash |
47 |
// new SwitchLanguageDialog(null, langsa).setModal(false); |
// without X11 DISPLAY |
48 |
|
return; |
49 |
|
|
50 |
|
ArrayList<String> langs = new ArrayList<String>(); |
51 |
|
langs.add("tr"); |
52 |
|
langs.add("fr"); |
53 |
|
langs.add("kj"); |
54 |
|
TestingUtil.testGui(new SwitchLanguageDialog(null, langs, false), 20); |
55 |
} |
} |
56 |
|
|
57 |
|
@Test |
58 |
|
public void testDialogDoesntAppearIf0OrOneLangOnly() throws Throwable { |
59 |
|
if (!TestingUtil.isInteractive()) |
60 |
|
// Test needed here because following GUI creation would crash |
61 |
|
// without X11 DISPLAY |
62 |
|
return; |
63 |
|
|
64 |
|
ArrayList<String> langs = new ArrayList<String>(); |
65 |
|
langs.add("fr"); |
66 |
|
|
67 |
|
long startTime = System.currentTimeMillis(); |
68 |
|
TestingUtil.testGui(new SwitchLanguageDialog(null, langs, false), 2); |
69 |
|
assertTrue("dialog did pop up incorrectly", System.currentTimeMillis() |
70 |
|
- startTime < 1000); |
71 |
|
} |
72 |
|
|
73 |
} |
} |