From c9a7cdf002c2d4dad766afda670b060e42c00b4e Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Fri, 9 Feb 2024 23:49:57 +0100 Subject: [PATCH 1/4] test_Emoji2 --- src/test/java/TestEmojiPicker.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/TestEmojiPicker.java b/src/test/java/TestEmojiPicker.java index 1279081..b10964e 100644 --- a/src/test/java/TestEmojiPicker.java +++ b/src/test/java/TestEmojiPicker.java @@ -90,4 +90,11 @@ public class TestEmojiPicker { assertEquals(expectedText, textField.getText(), "Failed for emoji: " + button.getText()); // Check if emoji is appended to the text field } } + + @Test + public void testEmojiPickerNotNull() { + JTextField textField = new JTextField(); + EmojiPicker emojiPicker = new EmojiPicker(textField); + assertNotNull(emojiPicker); + } } From 27540cba2036246de3a87157d7e2bf794583a20a Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Fri, 9 Feb 2024 23:50:13 +0100 Subject: [PATCH 2/4] test_Emoji3 --- src/test/java/TestEmojiPicker.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/TestEmojiPicker.java b/src/test/java/TestEmojiPicker.java index b10964e..59947c3 100644 --- a/src/test/java/TestEmojiPicker.java +++ b/src/test/java/TestEmojiPicker.java @@ -97,4 +97,17 @@ public class TestEmojiPicker { EmojiPicker emojiPicker = new EmojiPicker(textField); assertNotNull(emojiPicker); } + + @Test + public void testEmojiPickerLayout() { + JTextField textField = new JTextField(); + EmojiPicker emojiPicker = new EmojiPicker(textField); + LayoutManager layoutManager = emojiPicker.getLayout(); + assertTrue(layoutManager instanceof GridLayout); + GridLayout gridLayout = (GridLayout) layoutManager; + assertEquals(4, gridLayout.getRows()); + assertEquals(3, gridLayout.getColumns()); + } + + } From f34cf4fbbadf9c9cd3b3e01299d3aa683d717b67 Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Fri, 9 Feb 2024 23:50:43 +0100 Subject: [PATCH 3/4] test_Emoji4 --- src/test/java/TestEmojiPicker.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/java/TestEmojiPicker.java b/src/test/java/TestEmojiPicker.java index 59947c3..0ee459c 100644 --- a/src/test/java/TestEmojiPicker.java +++ b/src/test/java/TestEmojiPicker.java @@ -109,5 +109,13 @@ public class TestEmojiPicker { assertEquals(3, gridLayout.getColumns()); } + @Test + public void testEmojiPickerButtonCount1() { + JTextField textField = new JTextField(); + EmojiPicker emojiPicker = new EmojiPicker(textField); + Component[] components = emojiPicker.getComponents(); + assertEquals(12, components.length); + } + } From 024648af8c5a8653a4c2bcbb7eca0b4794d5fd6d Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Fri, 9 Feb 2024 23:51:21 +0100 Subject: [PATCH 4/4] test_Emoji5 --- src/test/java/TestEmojiPicker.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/java/TestEmojiPicker.java b/src/test/java/TestEmojiPicker.java index 0ee459c..9396f69 100644 --- a/src/test/java/TestEmojiPicker.java +++ b/src/test/java/TestEmojiPicker.java @@ -1,7 +1,7 @@ import org.junit.jupiter.api.Test; import javax.swing.*; import java.awt.*; - +import java.util.Arrays; import static org.junit.jupiter.api.Assertions.*; public class TestEmojiPicker { @@ -117,5 +117,22 @@ public class TestEmojiPicker { assertEquals(12, components.length); } - + @Test + public void testEmojiPickerButtonFont() { + JTextField textField = new JTextField(); + EmojiPicker emojiPicker = new EmojiPicker(textField); + Component[] components = emojiPicker.getComponents(); + for (Component component : components) { + if (component instanceof JButton) { + JButton button = (JButton) component; + Font buttonFont = button.getFont(); + assertEquals("Segoe UI Emoji", buttonFont.getFontName()); + assertEquals(Font.PLAIN, buttonFont.getStyle()); + assertEquals(20, buttonFont.getSize()); + } + } + } + + } + }