FEST

JListFixture.selectItem(...) doesn'twork if list visible rectangle is very small

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: FEST-Swing 1.1
  • Fix Version/s: FEST-Swing 1.1
  • Component/s: Swing
  • Labels:
    None
  • Number of attachments :
    0

Description

What steps will reproduce the problem?
1. Create an interface with a JList and set the visible size of the list very small in comparison to it's real size (horizontally)
2. Call JListFixture.selectItem(...) on this list, the call work but the item is not selected

What is the expected output? What do you see instead?
The item should be selected

Please provide any additional information below.
One solution is to change the calculation of the x position of the list. I try it in this method (replace 2 by 20) :

public Point pointAt(final JList list, final int index) {
    this.validate(list, index);
    final Rectangle cellBounds = cellBoundsOf(list, index);
    return new Point(cellBounds.x + cellBounds.width / 20, cellBounds.y + cellBounds.height / 2);
  }

My last comment :

Alex, I reproduce the bug on my computer, if you want I can send you the files. Here is the tip : after calling the itemFixture.select() method, you have to test the list.target.getSelectedIndex() method. And in my case this method returned -1, which is wrong because you just selected an item.


Original report: Issue 233 (Google Code)

Activity

Hide
Alex Ruiz added a comment -
Show
Alex Ruiz added a comment - Changes can be reviewed at http://code.google.com/p/fest/source/detail?r=2299

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: