jdk/test/java/awt/font/TextLayout/TestSinhalaChar.java
changeset 3933 38e8ef00316e
child 3937 6e5c2bd084bb
equal deleted inserted replaced
3932:c9cd7ff79037 3933:38e8ef00316e
       
     1 /* @test @(#)TestSinhalaChar.java
       
     2  * @summary verify lack of crash on U+0DDD.
       
     3  * @bug 6795060
       
     4  */
       
     5 
       
     6 import javax.swing.*;
       
     7 import javax.swing.border.LineBorder;
       
     8 import java.awt.*;
       
     9 import java.awt.event.ActionEvent;
       
    10 
       
    11 public class TestSinhalaChar {
       
    12     public static void main(String[] args) {
       
    13         SwingUtilities.invokeLater(new Runnable() {
       
    14             public void run() {
       
    15                 new TestSinhalaChar().run();
       
    16             }
       
    17         });
       
    18     }
       
    19     public static boolean AUTOMATIC_TEST=true;  // true; run test automatically, else manually at button push
       
    20 
       
    21     private void run() {
       
    22         JFrame frame = new JFrame("Test Character (no crash = PASS)");
       
    23         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
    24         JPanel panel = new JPanel();
       
    25         final JLabel label = new JLabel("(empty)");
       
    26         label.setSize(400, 100);
       
    27         label.setBorder(new LineBorder(Color.black));
       
    28         label.setFont(new Font("Lucida Bright", Font.PLAIN, 12));
       
    29         if(AUTOMATIC_TEST) {  /* run the test automatically (else, manually) */
       
    30            label.setText(Character.toString('\u0DDD'));
       
    31         } else {
       
    32         JButton button = new JButton("Set Char x0DDD");
       
    33         button.addActionListener(new AbstractAction() {
       
    34             public void actionPerformed(ActionEvent actionEvent) {
       
    35            label.setText(Character.toString('\u0DDD'));
       
    36             }
       
    37         });
       
    38         panel.add(button);
       
    39         }
       
    40         panel.add(label);
       
    41 
       
    42         frame.getContentPane().add(panel);
       
    43         frame.pack();
       
    44         frame.setVisible(true);
       
    45     }
       
    46 }
       
    47