assertj / assertj/assertj-swing

JComboBoxFixture.selectItem() does not set focus on ComboBox

Ouverte
#271 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
121
Forks
52
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I get failing tests even though my code is fine; the test is failing because `JComboBoxFixture.selectItem()` does not set focus on the ComboBox (as a user action would do).

(Background info: I am relying on the focus of ComboBoxes (or any of their subcomponents) as a trick to detect whether `ActionPerformed` or `ItemStateChanged` events are "real" ones (resulting from user actions) or "superfluous" ones (that ComboBoxes tend to throw on other inappropriate occasions.)

I verified this by debug output, but also when (visually) watching the test runnning, I notice that other UI elements (e.g. buttons) get a painted focus, while the combobox does not.
My colleague @Gleethos had a look at `JComboBoxDriver` and `JComboBoxSetSelectedIndexTask`, and we think that there should be some code setting focus (like an analogon to `JButton.doClick()`, which does set the focus for buttons).

P.S. If this is welcome, we could try to add/fix it and create a pull-request...?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par JComboBoxFixture.selectItem(), puis suivez le JComboBoxDriver et la JComboBoxSetSelectedIndexTask associés mentionnés dans l'issue. Comparez leur comportement avec le comportement du focus de JButton.doClick(). La tâche est terminée lorsque la sélection d'un élément donne au ComboBox le focus attendu d'une action utilisateur et que les tests concernés passent.

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é
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

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