assertj / assertj/assertj-swing

Unable to find JPopupMenu in certain circumstances

Aperta
#76 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug import from fest-swing Major
Lingua principale
Java
Stelle
121
Fork
52
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

_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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in BasicRobot, in corrispondenza di POPUP_MATCHER e activePopupMenu, quindi esamina come vengono trovati i componenti popup quando esistono più istanze di JPopupMenu. Riproduci, se possibile, gli stati visibile e nascosto del popup; il lavoro è completato quando viene trovato il popup visibile attivo senza che il finder segnali una falsa ambiguità.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
desktop, testing
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.