assertj / assertj/assertj-swing

Unable to find JPopupMenu in certain circumstances

Abierto
#76 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug import from fest-swing Major
Lenguaje dominante
Java
Estrellas
121
Forks
52
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

_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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en BasicRobot, en POPUP_MATCHER y activePopupMenu, y luego inspecciona cómo se encuentran los componentes popup cuando existen varias instancias de JPopupMenu. Reproduce, si es posible, los estados visible y oculto del popup; la tarea está terminada cuando se encuentra el popup visible activo sin que el finder informe de una ambigüedad falsa.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
desktop, testing
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.