assertj / assertj/assertj-swing
Unable to find JPopupMenu in certain circumstances
- Vorherrschende Sprache
- Java
- Sterne
- 121
- Forks
- 52
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
_Issue by **[Bo Andersson](http://jira.codehaus.org/secure/ViewProfile.jspa?name=band)** from Tue, 31 Aug 2010 13:03:55 -0500_
_Originally opened as http://jira.codehaus.org/browse/FEST-386_
---
I have an application with several popupmenus attached to different components. When trying to run tests against those popup menus, fest swing is able to bring up the popup menu but is unable to find it. Investigation showed that the visible popup have the state isVisible() and isShowing() while the invisible popup(s) still have the isShowing() state but !isVisible(). This causes current finder logic to actually find two popups (which shouldn't be possible) and thus it returns an error saying it cannot find any popup whatsoever.
Unfortunately I'm unable to contribute a testcase since I haven't been able to reproduce this state in a self-contained test - however, I made some modifications to the current fest-swing code for testing my own app and simply changing the BasicRobot.POPUP_MATCHER to
private static final ComponentMatcher POPUP_MATCHER =
new AbstractComponentMatcher() {
public boolean matches(Component c)
{
return c.getClass().equals(JPopupMenu.class) && c.isVisible() && c.isShowing();
}
;
};
solved my issue, i.e check both isVisible() and isShowing() instead of simply isShowing().
Another proposal regarding this issue would be to add a check in BasicRobot.activePopupMenu() similar to
if (found.size() > 1) throw new IllegalStateException("Popup matcher incorrectly returned more than one visible popupMenu")
to assert against matcher problems due to strange component states.
---
votes (original issue): 0
watches (original issue): 0
Beitragsleitfaden
Rechercherichtung
Beginne in BasicRobot bei POPUP_MATCHER und activePopupMenu und untersuche anschließend, wie Popup-Komponenten gefunden werden, wenn mehrere JPopupMenu-Instanzen vorhanden sind. Reproduziere nach Möglichkeit die sichtbaren und verborgenen Popup-Zustände; abgeschlossen ist die Aufgabe, wenn das aktive sichtbare Popup gefunden wird, ohne dass der Finder eine falsche Mehrdeutigkeit meldet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- desktop, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100