From 8db6fa4b37556806560891ac5597728e443a41c4 Mon Sep 17 00:00:00 2001 From: Marcus Rockwell Date: Wed, 4 Sep 2024 10:22:06 -0400 Subject: [PATCH] updated status message pane tests --- .../simcontrol/StubbedSimControlTests.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/trick_source/java/src/test/java/trick/simcontrol/StubbedSimControlTests.java b/trick_source/java/src/test/java/trick/simcontrol/StubbedSimControlTests.java index 6a7ded68..9e8682e2 100644 --- a/trick_source/java/src/test/java/trick/simcontrol/StubbedSimControlTests.java +++ b/trick_source/java/src/test/java/trick/simcontrol/StubbedSimControlTests.java @@ -44,6 +44,7 @@ import static org.assertj.swing.launcher.ApplicationLauncher.application; public class StubbedSimControlTests extends AssertJSwingJUnitTestCase { private FrameFixture mainFrame; private JPanelFixture findPanel; + private JTextComponentFixture editorFixture; private StubbedSimControlApplication app = null; @BeforeClass @@ -55,7 +56,9 @@ public class StubbedSimControlTests extends AssertJSwingJUnitTestCase { protected void onSetUp() { application(StubbedSimControlApplication.class).start(); app = StubbedSimControlApplication.getInstance(); + mainFrame = getFrameByTitle("Sim Control"); + findPanel = mainFrame.panel( new GenericTypeMatcher(JXFindBar.class) { @Override @@ -65,6 +68,15 @@ public class StubbedSimControlTests extends AssertJSwingJUnitTestCase { } ); + editorFixture = mainFrame.textBox( + new GenericTypeMatcher(JXEditorPane.class) { + @Override + protected boolean isMatching(JXEditorPane pane) { + return true; + } + } + ); + sleep(500); updateState(); } @@ -148,15 +160,6 @@ public class StubbedSimControlTests extends AssertJSwingJUnitTestCase { @Test public void testStatusMsgPane() { // ARRANGE - JTextComponentFixture editorFixture = mainFrame.textBox( - new GenericTypeMatcher(JXEditorPane.class) { - @Override - protected boolean isMatching(JXEditorPane pane) { - return true; - } - } - ); - final String msg = "How much wood can a woodchuck chuck if a woodchuck could chuck wood?"; assumeThat(editorFixture).isNotNull(); @@ -172,7 +175,7 @@ public class StubbedSimControlTests extends AssertJSwingJUnitTestCase { @Test public void testFindPanelButtons() { // ARRANGE - String message = "I must not fear.\n" + // + final String message = "I must not fear.\n" + // "Fear is the mind-killer.\n" + // "Fear is the little-death that brings total obliteration.\n" + // "I will face my fear.\n" + // @@ -188,13 +191,14 @@ public class StubbedSimControlTests extends AssertJSwingJUnitTestCase { String[] queryResults = new String[10]; - JTextComponentFixture editorFixture = setStatusMessage(message); JXEditorPane editorPane = (JXEditorPane) editorFixture.target(); JButtonFixture findNextButton = getButtonByText(findPanel, "Find Next"), findPrevButton = getButtonByText(findPanel, "Find Previous"); assumeThat(findNextButton).isNotNull(); assumeThat(findPrevButton).isNotNull(); + + setStatusMessage(message); // ACT setFindText("Hello");