assertj / assertj/assertj-swing
JComboBoxFixture.selectItem() does not set focus on ComboBox
- Vorherrschende Sprache
- Java
- Sterne
- 121
- Forks
- 52
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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...?
Beitragsleitfaden
Rechercherichtung
Beginne mit JComboBoxFixture.selectItem(), und verfolge dann den zugehörigen JComboBoxDriver und die JComboBoxSetSelectedIndexTask, die im Issue erwähnt werden. Vergleiche ihr Verhalten mit dem Fokusverhalten von JButton.doClick(). Als erledigt gilt, dass die Auswahl eines Elements der ComboBox den von einer Benutzeraktion erwarteten Fokus gibt und die relevanten Tests bestehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- desktop, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100