From 859fa94ec04c88e4e499e153efd2ce2188c2fc34 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 5 Feb 2019 13:51:22 +0000 Subject: [PATCH] Test (passes!) for dialog message truncation --- utils/test/JalviewJSTest.java | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/utils/test/JalviewJSTest.java b/utils/test/JalviewJSTest.java index 0d4d708..d81e392 100644 --- a/utils/test/JalviewJSTest.java +++ b/utils/test/JalviewJSTest.java @@ -1,4 +1,8 @@ package test; +import jalview.gui.Desktop; +import jalview.gui.JvOptionPane; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.ComponentOrientation; import java.awt.Container; @@ -36,7 +40,30 @@ public class JalviewJSTest extends JPanel { public static void main(String[] args) { - new JalviewJSTest().doTest4(); + new JalviewJSTest().doTest5(); + } + + /** + * Dialog message truncation + */ + void doTest5() + { + JFrame main = new JFrame(); + main.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + main.setContentPane(new JPanel()); + main.setMinimumSize(new Dimension(100, 100)); + main.pack(); + main.setVisible(true); + + /* + * like AlignFrame.delete_actionPerformed() + * except here it works fine, also in JS + */ + JvOptionPane dialog = JvOptionPane.newOptionDialog(null); + Object[] options = new Object[] { "OK", "Cancel" }; + String msg = "Deleting all sequences will close the alignment window.
Confirm deletion or Cancel."; + dialog.showDialog(msg, "", JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null, options, options[0]); + } void doTest4() @@ -67,10 +94,11 @@ public class JalviewJSTest extends JPanel System.out.println("f2 hashCode = " + f2.hashCode()); System.out.println(map.get(f2)); } + /** * Put some content in a JFrame and show it */ - void doTest() + void doTest1() { System.out.println("ab;c;".split(";")); new DecimalFormat("###,###").format((Integer) 1); -- 1.7.10.2