phamow / fest

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

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 eral 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

What version of the product are you using? On what operating system?

1.0b2.1

Please provide any additional information below.

One solution is to change the calcul 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);
  }

Original issue reported on code.google.com by cimballi...@gmail.com on 13 Nov 2008 at 8:01

GoogleCodeExporter commented 9 years ago
[deleted comment]
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 5:13

GoogleCodeExporter commented 9 years ago
We'll release this issue in version 1.1.

Original comment by Alex.Rui...@gmail.com on 4 Dec 2008 at 6:04

GoogleCodeExporter commented 9 years ago
What is the size of the JList that you are using? I just want to make sure I'm
reproducing the bug correctly.

Original comment by Alex.Rui...@gmail.com on 5 Feb 2009 at 7:48

GoogleCodeExporter commented 9 years ago
I didn't remember well, but the size itself is not really important. What's 
important
is that the text of the list element must be a lot more larger than the list. 
For
example, if you have a list of width 100px, and an element with 100 "m" 
characters,
then you will have the problem.

Original comment by cimballi...@gmail.com on 5 Feb 2009 at 12:35

GoogleCodeExporter commented 9 years ago
I couldn't reproduce this bug. Please see the test case at
http://code.google.com/p/fest/source/detail?r=2266 (r2266).

Thanks,
-Alex

Original comment by Alex.Rui...@gmail.com on 9 Feb 2009 at 6:20

GoogleCodeExporter commented 9 years ago
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 nethod return -1, 
which is
wrong because you just selectedan item.

Original comment by cimballi...@gmail.com on 9 Feb 2009 at 2:33