benjamin84 / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

JListFixture#selectItems behavior #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am using version 1.0a1 of the FEST-Swing module.

JListFixture#selectItems should really be named toggleItems.
The problem is that the item or items which are already selected before a
call to selectItems can remain selected after the call.

  public void selectItems(JList list, Object[] values) {
    int controlOrCommand = controlOrCommandKey();
    robot.pressKey(controlOrCommand);
    for (Object value : values) selectItem(list, value);
    robot.releaseKey(controlOrCommand);
  }

The problem is with the control/command key. It should be pressed after
selecting the first item.

An implementation might look like:

  public void selectItems(JList list, Object[] values) {
    if (values.length == 0) {
//    do something sensible
    }
    selectItem(list, values[0]);
    if (values.length > 1) {
      int controlOrCommand = controlOrCommandKey();
      robot.pressKey(controlOrCommand);
      for (int i = 1; i < values.length; ++i) selectItem(list, values[i]);
      robot.releaseKey(controlOrCommand);
    }
  }

I would like to see both selectItems and toggleItems implemented.

I would also like to see
  selectItem(Pattern item)
  selectItems(Pattern items)
  toggleItems(Pattern items)
  selectItems(Pattern from, Pattern to)
  toggleItems(Pattern from, Pattern to)
where Pattern is java.util.regex.Pattern.

In general, each method accepting a String should have a corresponding
method accepting a Regex.

Original issue reported on code.google.com by csaba.ju...@gmail.com on 9 Jun 2008 at 11:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fix was also applied to JTableDriver and JTreeDriver.

Original comment by Alex.Rui...@gmail.com on 13 Jun 2008 at 6:55

GoogleCodeExporter commented 9 years ago
Multiple selection has been fixed. I'm going to file separate bugs for the 
additional
items mentioned in this bug.

Many thanks!
-Alex

Original comment by Alex.Rui...@gmail.com on 13 Jun 2008 at 7:07

GoogleCodeExporter commented 9 years ago
Filed issue 155 and issue 156 to take care of the other enhancement requests.

Original comment by Alex.Rui...@gmail.com on 13 Jun 2008 at 7:12

GoogleCodeExporter commented 9 years ago
Set the module as a label, instead of being part of the title.

Original comment by Alex.Rui...@gmail.com on 1 Dec 2008 at 2:00