assertj / assertj/assertj-swing

Unable to find JPopupMenu in certain circumstances

Ouverte
#76 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug import from fest-swing Major
Langage dominant
Java
Étoiles
121
Forks
52
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

_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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans BasicRobot, au niveau de POPUP_MATCHER et de activePopupMenu, puis examinez comment les composants popup sont trouvés lorsque plusieurs instances de JPopupMenu existent. Reproduisez si possible les états visible et masqué du popup ; le travail est terminé lorsque le popup visible actif est trouvé sans que le finder signale une fausse ambiguïté.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
desktop, testing
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.