Skip to content

Commit

Permalink
add delay to EditorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmipt committed Jan 5, 2024
1 parent d771c53 commit c4d1d95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/studio/ui/StudioWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -835,11 +835,9 @@ public void close() {
} else {
boolean result = execute(editorTab -> editorTab.getEditorsPanel().closeTab(editorTab));
if (!result) return;
log.info("StudioWindow closing");
// closing the last tab would trigger this code again
if (allWindows.contains(this)) {
allWindows.remove(this);
log.info("StudioWindow disposing");
dispose();
refreshAllMenus();
}
Expand Down
5 changes: 5 additions & 0 deletions test-integration/studio/ui/EditorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.concurrent.TimeUnit;

import static org.assertj.swing.edt.GuiActionRunner.execute;
import static org.assertj.swing.timing.Pause.pause;
import static org.junit.Assert.assertEquals;

public class EditorTest extends StudioTest {
Expand Down Expand Up @@ -112,11 +114,14 @@ protected boolean isMatching(StudioWindow f) {
newFrameFixture.textBox("editor1").enterText("x");
newFrameFixture.menuItem("Close Window").click();
optionPaneButtonClick("Cancel");

pause(50, TimeUnit.MILLISECONDS); // wait as closure happens asynchronously
newFrameFixture.requireVisible();

//tear down
newFrameFixture.close();
optionPaneButtonClick("No");
pause(50, TimeUnit.MILLISECONDS); // wait as closure happens asynchronously
newFrameFixture.requireNotVisible();

Check failure on line 125 in test-integration/studio/ui/EditorTest.java

View workflow job for this annotation

GitHub Actions / JUnit Tests

studio.ui.EditorTest ► testCancelOnFrameClosure

Failed test found in: build/test-results/integrationTest/TEST-studio.ui.EditorTest.xml Error: org.junit.ComparisonFailure: [studio.ui.StudioWindow[name='studioWindow2', title='Script2 (not saved) Studio for kdb+ dz3.0.1', enabled=true, visible=true, showing=true] - property:'visible'] expected:<[fals]e> but was:<[tru]e>
Raw output
org.junit.ComparisonFailure: [studio.ui.StudioWindow[name='studioWindow2', title='Script2 (not saved) Studio for kdb+ dz3.0.1', enabled=true, visible=true, showing=true] - property:'visible'] expected:<[fals]e> but was:<[tru]e>
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at studio.ui.EditorTest.testCancelOnFrameClosure(EditorTest.java:125)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
}
}

0 comments on commit c4d1d95

Please sign in to comment.