United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4677084 : JCK1.4: api/java_awt/interactive/ScrollbarTests.html

Details
Type:
Bug
Submit Date:
2002-04-30
Status:
Closed
Updated Date:
2003-11-10
Project Name:
JDK
Resolved Date:
2003-10-23
Component:
client-libs
OS:
solaris_9,solaris_8,linux,windows_2000
Sub-Component:
java.awt
CPU:
x86,sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.1,1.4.2
Fixed Versions:
5.0 (b26)

Related Reports

Sub Tasks

Description

Name: kaR10181			Date: 04/30/2002



2 testcases ScrollbarTest0003, ScrollbarTest0004 from the 
JCK1.4 test api/java_awt/interactive/ScrollbarTests.html fail.
The testcases verify the behavior of Scrollbar.setBlockIncrement(int v),
Scrollbar.setUnitIncrement(int v) methods. They fail due to the following
reason - setting negative value for increment does NOT change scrollbar
behavior. If block/unit increment is negative, the scrollbar should decrement
its value when user tryes to increment it. The specification reads 
(doc/api/java/awt/Scrollbar.html):
	"setUnitIncrement

	 public void setUnitIncrement(int v)

       	 Sets the unit increment for this scroll bar. 

         The unit increment is the value that is added (subtracted) when 
	 the user activates the unit increment area of the scroll bar, 
	 generally through a mouse or keyboard gesture that the scroll bar receives 
         as an adjustment event. 

         Specified by:
              setUnitIncrement in interface Adjustable
         Parameters:
              v - the amount by which to increment or decrement the scroll 
	 bar's value
	
	 setBlockIncrement

	 public void setBlockIncrement(int v)

         Sets the block increment for this scroll bar. 

         The block increment is the value that is added (subtracted) when 
	 the user activates the block increment area of the scroll bar, 
	 generally through a mouse or keyboard gesture that the scroll bar receives 
	 as an adjustment event. 

         Parameters:
              v - the amount by which to increment or decrement the scroll 
	 bar's value"

Bug is reproducible in plugin, solaris 5.8, 
linux. 

It seems tests failed due to native implementation of scrollbar which can't
work with negative values for block/unit increment.

Filed By       : J2SE-SQA [###@###.###
JDK	       : jdk1.4.1-b10
JCK	       : JCK1.4-b17
Platform[s]    : RedHat Linux 7.2, RedHat Linux 7.1, Solaris 5.8
switch/Mode    : -client -Xmixed
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Failing Test   : api/java_awt/interactive/ScrollbarTests.java

Test source location:
=====================
 
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_awt/interactive/ScrollbarTests.java

jtr file location:
==================

/net/jtgb4u4c.eng/export/sail15/results/hopper/b10/jck14/i386/s8_plugin_ns6.2_linux-6/workDir/api-interactive/java_awt/interactive/ScrollbarTests_ScrollbarTests.jtr

How to reproduce:
=================
---------Script start-------------------
#!/bin/sh
JCK=/net/linux-15/export/home/java/jck1.4/JCK-runtime-14
export JCK
CLASSPATH="${JCK}/classes;${JCK}/javatest.jar"
export CLASSPATH
JAVA_HOME=/net/linux-15/export/home/java/jdk1.4.1/linux/
export JAVA_HOME

$JAVA_HOME/bin/java -version
$JAVA_HOME/bin/java -cp ${JCK}/classes\:${JCK}/javatest.jar -Xfuture -client -Xmixed javasoft.sqe.tests.api.java.awt.interactive.Scrollbar.ScrollbarTests -TestCaseID ScrollbarTest0003 ScrollbarTest0004


---------Script end  -------------------


Set negative value for setBlockIncrement and setUnitIncrementa attributes 
After that, try to block/unit increment. The scrollbar should decrement 
its value, but it increments.   

Test output:
================
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b10)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b10, mixed mode)
Warning: 
    Name: scrollbar
    Class: XmScrollBar
    The scrollbar page increment is less than 1.

Warning: 
    Name: scrollbar
    Class: XmScrollBar
    The scrollbar increment is less than 1.

ScrollbarTest0003: Failed. Scrollbar test does NOT work as expected.
ScrollbarTest0004: Failed. Scrollbar test does NOT work as expected.
STATUS:Failed.tests: 2; failed: 2; first test case
failure: ScrollbarTest0003

Specific Machine Info:
======================
Hostname: linux-24
OS: RedHat Linux 7.2/Gnome

======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger
tiger-beta

FIXED IN:
tiger
tiger-beta

INTEGRATED IN:
tiger-b26
tiger-beta

VERIFIED IN:
tiger-beta


                                     
2004-06-14
SUGGESTED FIX

------- Scrollbar.java -------
*** /tmp/sccs.NhaGti    Sat Sep 20 14:25:14 2003
--- Scrollbar.java      Sat Sep 20 14:25:07 2003
***************
*** 216,222 ****
      /**
       * The amount by which the scrollbar value will change when going
       * up or down by a line.
!      * This value should be a non negative integer.
       *
       * @serial
       * @see #getLineIncrement
--- 216,222 ----
      /**
       * The amount by which the scrollbar value will change when going
       * up or down by a line.
!      * This value must be a positive integer.
       *
       * @serial
       * @see #getLineIncrement
***************
*** 227,233 ****
      /**
       * The amount by which the scrollbar value will change when going
       * up or down by a page.
!      * This value should be a non negative integer.
       *
       * @serial
       * @see #getPageIncrement
--- 227,233 ----
      /**
       * The amount by which the scrollbar value will change when going
       * up or down by a page.
!      * This value must be a positive integer.
       *
       * @serial
       * @see #getPageIncrement
***************
*** 657,666 ****
      /**
       * Sets the unit increment for this scroll bar.
       * <p>
!      * The unit increment is the value that is added (subtracted)
       * when the user activates the unit increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
       * 
       * @param        v  the amount by which to increment or decrement
       *                         the scroll bar's value
--- 657,669 ----
      /**
       * Sets the unit increment for this scroll bar.
       * <p>
!      * The unit increment is the value that is added or subtracted
       * when the user activates the unit increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
+      * The unit increment must be a positive integer.  
+      * Attepts to set the unit increment to a value lower than 1 
+      * will result in a value of 1 being set.  
       * 
       * @param        v  the amount by which to increment or decrement
       *                         the scroll bar's value
***************
*** 676,695 ****
       * replaced by <code>setUnitIncrement(int)</code>.
       */
      public synchronized void setLineIncrement(int v) {
!       lineIncrement = v;
!       ScrollbarPeer peer = (ScrollbarPeer)this.peer;
!       if (peer != null) {
!           peer.setLineIncrement(v);
!       }
      }
  
      /**
       * Gets the unit increment for this scrollbar.
       * <p>
!      * The unit increment is the value that is added (subtracted)
       * when the user activates the unit increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
       * 
       * @return      the unit increment of this scroll bar
       * @see         java.awt.Scrollbar#setUnitIncrement
--- 679,705 ----
       * replaced by <code>setUnitIncrement(int)</code>.
       */
      public synchronized void setLineIncrement(int v) {
!         int tmp = (v < 1) ? 1 : v; 
! 
!         if (lineIncrement == tmp) {
!             return; 
!         }
!         lineIncrement = tmp; 
! 
!         ScrollbarPeer peer = (ScrollbarPeer)this.peer;
!         if (peer != null) {
!             peer.setLineIncrement(lineIncrement);
!         }
      }
  
      /**
       * Gets the unit increment for this scrollbar.
       * <p>
!      * The unit increment is the value that is added or subtracted
       * when the user activates the unit increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
+      * The unit increment must be a positive integer.  
       * 
       * @return      the unit increment of this scroll bar
       * @see         java.awt.Scrollbar#setUnitIncrement
***************
*** 710,719 ****
      /**
       * Sets the block increment for this scroll bar.
       * <p>
!      * The block increment is the value that is added (subtracted)
       * when the user activates the block increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
       * 
       * @param        v  the amount by which to increment or decrement
       *                         the scroll bar's value
--- 720,732 ----
      /**
       * Sets the block increment for this scroll bar.
       * <p>
!      * The block increment is the value that is added or subtracted
       * when the user activates the block increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
+      * The block increment must be a positive integer.  
+      * Attepts to set the block increment to a value lower than 1 
+      * will result in a value of 1 being set.  
       * 
       * @param        v  the amount by which to increment or decrement
       *                         the scroll bar's value
***************
*** 729,748 ****
       * replaced by <code>setBlockIncrement()</code>.
       */
      public synchronized void setPageIncrement(int v) {
!       pageIncrement = v;
!       ScrollbarPeer peer = (ScrollbarPeer)this.peer;
!       if (peer != null) {
!           peer.setPageIncrement(v);
!       }
      }
  
      /**
       * Gets the block increment of this scroll bar.
       * <p>
!      * The block increment is the value that is added (subtracted)
       * when the user activates the block increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
       * 
       * @return      the block increment of this scroll bar
       * @see         java.awt.Scrollbar#setBlockIncrement
--- 742,768 ----
       * replaced by <code>setBlockIncrement()</code>.
       */
      public synchronized void setPageIncrement(int v) {
!         int tmp = (v < 1) ? 1 : v; 
! 
!         if (pageIncrement == tmp) {
!             return; 
!         }
!         pageIncrement = tmp; 
! 
!         ScrollbarPeer peer = (ScrollbarPeer)this.peer;
!         if (peer != null) {
!             peer.setPageIncrement(pageIncrement);
!         }
      }
  
      /**
       * Gets the block increment of this scroll bar.
       * <p>
!      * The block increment is the value that is added or subtracted
       * when the user activates the block increment area of the
       * scroll bar, generally through a mouse or keyboard gesture
       * that the scroll bar receives as an adjustment event.
+      * The block increment must be a positive integer.  
       * 
       * @return      the block increment of this scroll bar
       * @see         java.awt.Scrollbar#setBlockIncrement

###@###.### 2003-09-24
                                     
2003-09-24
EVALUATION

I disagree with this interpretation of the spec from the Description:
"If block/unit increment is negative, the scrollbar should decrement
its value when user tryes to increment it."

The increment is intended to be an absolute value, which is added to
the scrollbar value or subtracted from the scrollbar value.

Closing as "not a bug".

###@###.### 2002-04-30

We should update the specification to say that values less than 1 are not 
meaningful.  Since the underlying toolkit appears not to handle them correctly, 
and our implementation has never been consistent, we should probably specify 
and enforce 1 as a minimum value.  That would give us cross-platform 
compatibility and would be a good UI design as well.  I doubt that anyone 
would experience backwards compatibility problems.  

Since this is a spec change, we should do it for Tiger. 
###@###.### 2002-05-01
                                     
2002-05-01



Hardware and Software, Engineered to Work Together