diff options
author | Hannah Chu <hanchu@google.com> | 2019-08-14 14:31:25 -0700 |
---|---|---|
committer | Hannah Chu <hanchu@google.com> | 2019-08-14 15:05:19 -0700 |
commit | 9005d51e14e02fc0bba416d77b231dbe3ea2b313 (patch) | |
tree | 5e9b7bf1534858940c97f2b7fb147738722f025b | |
parent | df1ed04d564c5d4c1b95d3c75321a18bec6140bc (diff) | |
download | swing-testing-9005d51e14e02fc0bba416d77b231dbe3ea2b313.tar.gz |
Run JTree row queries on EDT
com.intellij.ui.tree.ui.DispatchThreadValidator does not allow
background threads to handle Swing components, so move the getRowCount()
to EDT instead.
Bug: 138841377
Test: LayoutInspectorTest
Change-Id: I925d0b0fc64d239246837ded0f8335a67e8d3781
-rw-r--r-- | fest-swing/src/main/java/org/fest/swing/fixture/JTreeFixture.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fest-swing/src/main/java/org/fest/swing/fixture/JTreeFixture.java b/fest-swing/src/main/java/org/fest/swing/fixture/JTreeFixture.java index 87fbc064..ab51c95e 100644 --- a/fest-swing/src/main/java/org/fest/swing/fixture/JTreeFixture.java +++ b/fest-swing/src/main/java/org/fest/swing/fixture/JTreeFixture.java @@ -14,20 +14,20 @@ */ package org.fest.swing.fixture; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.swing.JPopupMenu; import javax.swing.JTree; - import org.fest.swing.cell.JTreeCellReader; import org.fest.swing.core.MouseButton; import org.fest.swing.core.MouseClickInfo; import org.fest.swing.core.Robot; import org.fest.swing.driver.BasicJTreeCellReader; import org.fest.swing.driver.JTreeDriver; +import org.fest.swing.edt.GuiQuery; import org.fest.swing.exception.ActionFailedException; import org.fest.swing.exception.ComponentLookupException; import org.fest.swing.exception.LocationUnavailableException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * <p> @@ -655,4 +655,11 @@ public class JTreeFixture extends AbstractJPopupMenuInvokerFixture<JTreeFixture, public @Nullable String valueAt(@NotNull String path) { return driver().nodeValue(target(), path); } + + /** + * @return the number of viewable nodes + */ + public int getRowCount() { + return GuiQuery.getNonNull(() -> target().getRowCount()); + } }
\ No newline at end of file |