|
|
@ -70,4 +70,24 @@ public class TestEmojiPicker { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
@Test |
|
|
|
public void testEmojiPickerActionListenerFunctionality() { |
|
|
|
JTextField textField = new JTextField(); |
|
|
|
|
|
|
|
EmojiPicker emojiPicker = new EmojiPicker(textField); |
|
|
|
|
|
|
|
Component[] components = emojiPicker.getComponents(); |
|
|
|
for (Component component : components) { |
|
|
|
|
|
|
|
assertTrue(component instanceof JButton); |
|
|
|
JButton button = (JButton) component; |
|
|
|
EmojiPicker.EmojiActionListener actionListener = (EmojiPicker.EmojiActionListener) button.getActionListeners()[0]; |
|
|
|
|
|
|
|
assertNotNull(actionListener); |
|
|
|
|
|
|
|
actionListener.actionPerformed(null); |
|
|
|
assertEquals(button.getText(), textField.getText()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|