api/java_awt/ScrollPane/descriptions.html#sets doesn't work correctly on windows.

XMLWordPrintable

    • generic
    • windows

      JCK : JCK6.0 b29
      J2SE : FAIL - mustang b97
      Platform[s] : FAIL - windows
      switch/Mode : FAIL - default

      It seems that consequent calls of setScrollPosition stops working properly after some time. Two JCK tests fail because of this:

      api/java_awt/ScrollPane/descriptions.html#sets[ScrollPane0408_15]
      api/java_awt/ScrollPane/descriptions.html#sets[ScrollPane0415_15]

      Steps to reproduce:

      run the following code on windows.

      import java.awt.*;
      import java.io.PrintWriter;
      import java.util.Properties;
      import java.util.Vector;

      public class ScrollPaneTest{

      public static void main(String[] args){
              Point p;
              Frame frame = new Frame();
              frame.setBounds(100, 100, 100, 100);
              ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); // Create new ScrollPane
              Canvas canvas = new Canvas(); // Create new Canvas
              canvas.setSize(200, 200);
              sp.add(canvas);
              frame.add("Center", sp);
              frame.setVisible(true);

              for (int i = 0; i < 10; i++) {
                  try
      {
      p = new Point(55, 55);
      sp.setScrollPosition(p.x, p.y);
                       waitForScrollPosition(sp, p);

      p = new Point(56, 56);
      sp.setScrollPosition(p.x, p.y);
                       waitForScrollPosition(sp, p);

                  }
      catch (InterruptedException e)
      {
                       frame.dispose();
                       System.out.println( "couldn't wait till the right scroll position" );
      return;
                  }
              }
              frame.dispose();
              System.out.println("OKAY");
       }


          public static void waitForScrollPosition(ScrollPane sp,Point p)
              throws InterruptedException {

              String lock = "the lock";
              synchronized (lock) {
      System.out.println("ScrollPositio is: "+sp.getScrollPosition()+" should be "+p);
                  for (int i=0; !p.equals(sp.getScrollPosition()) && (i < 10); i++) {
      System.out.println("ScrollPosition is: "+sp.getScrollPosition()+" should be "+p);
                      lock.wait(1000);
                  }
                  if ( !p.equals(sp.getScrollPosition()) ) {
                      System.out.println("set position: "+p);
                      System.out.println("get position: "+sp.getScrollPosition());
                      throw new InterruptedException("Bad scroll position for pretty long time");
                  }
              }
          }




      }


      You'll see that despite this code just moves scroll position from 55,55 to 56,56 and backwards it works for the first time but after some attempts goes to 0,56.

            Assignee:
            Yuri Nesterenko (Inactive)
            Reporter:
            Pavel Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: