assertj / assertj/assertj-swing

JComboBoxFixture.selectItem() does not set focus on ComboBox

Aperta
#271 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
121
Fork
52
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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...?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da JComboBoxFixture.selectItem(), quindi traccia il JComboBoxDriver e la JComboBoxSetSelectedIndexTask correlati menzionati nell'issue. Confronta il loro comportamento con il comportamento del focus di JButton.doClick(). Il lavoro è completato quando la selezione di un elemento assegna al ComboBox il focus atteso da un'azione dell'utente e i test pertinenti hanno esito positivo.

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

Valutazione

Stack tecnologico
java
Ambito
desktop, testing
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.