-
Enhancement
-
Resolution: Won't Fix
-
P4
-
6
-
sparc
-
solaris_2.6
awt.List.getMinimumSize(int rows) (Also deprecated method minimumSize),
when the rows param is less than zero the returned Dimension object has a
height value that is negative. A negative row value should not be allowed, should get some kind of exception thrown (i.e. IllegalArgumentException).
/*
* @(#)GetMinimumSizeTest.java
* @author JTG East 5/26/99
* @version 1.0
* @bug
*
* java.awt.List.getMinimumSize method tests
*/
import java.awt.*;
import java.io.*;
public class GetMinimumSizeTest extends Frame
{
List l;
GetMinimumSizeTest()
{
super("minimumSize() Test");
l = new List();
}
public static void main(String[] args)
{
if( bound() )
{
System.out.println("Test for List.getMinimumSize Failed");
System.exit(1);
}
else
{
System.out.println("Test for List.getMinimumSize Passed");
System.exit(0);
}
}
public static boolean bound()
{
//Test method with boundry conditions
GetMinimumSizeTest m = new GetMinimumSizeTest();
Dimension d = new Dimension();
boolean fail = false;
m.setSize(400, 400);
m.setVisible(true);
m.add(m.l);
d = m.l.getMinimumSize(-1); /* bug returns negative height value */
//d = m.l.minimumSize(-1);
System.out.println("getMinimumSize return: " + d);
if( (d.width <= 0) || (d.height <= 0) )
{
System.out.println("fail");
fail = true;
}
return fail;
}
}
when the rows param is less than zero the returned Dimension object has a
height value that is negative. A negative row value should not be allowed, should get some kind of exception thrown (i.e. IllegalArgumentException).
/*
* @(#)GetMinimumSizeTest.java
* @author JTG East 5/26/99
* @version 1.0
* @bug
*
* java.awt.List.getMinimumSize method tests
*/
import java.awt.*;
import java.io.*;
public class GetMinimumSizeTest extends Frame
{
List l;
GetMinimumSizeTest()
{
super("minimumSize() Test");
l = new List();
}
public static void main(String[] args)
{
if( bound() )
{
System.out.println("Test for List.getMinimumSize Failed");
System.exit(1);
}
else
{
System.out.println("Test for List.getMinimumSize Passed");
System.exit(0);
}
}
public static boolean bound()
{
//Test method with boundry conditions
GetMinimumSizeTest m = new GetMinimumSizeTest();
Dimension d = new Dimension();
boolean fail = false;
m.setSize(400, 400);
m.setVisible(true);
m.add(m.l);
d = m.l.getMinimumSize(-1); /* bug returns negative height value */
//d = m.l.minimumSize(-1);
System.out.println("getMinimumSize return: " + d);
if( (d.width <= 0) || (d.height <= 0) )
{
System.out.println("fail");
fail = true;
}
return fail;
}
}