Pavel Tisnovsky | 2 Sep 2011 17:33
Picon
Favicon

RFC: fix for Mauve test javax/swing/Border/TitledBorder/constructors.java

Greetings,

here's fix for another Mauve test. In the test
"javax/swing/Border/TitledBorder/constructors.java" the position of the title in
the border should be compared with the constant TitledBorder.DEFAULT_POSITION,
not with TitledBorder.TOP, at least in cases when following constructors are used:

TitledBorder(Border border)
TitledBorder(Border border, String title)
TitledBorder(String title)

(there exist three other constructors where title position can be explicitly
specified, but the fix changes only test cases which use the previous three
constructors).

Here's proposed fix for the test:

--- javax/swing/border/Border/TitledBorder/constructors.java    2006-02-01
15:14:22.000000000 +0100
+++ javax/swing/border/Border/TitledBorder/constructors.java    2011-09-02
16:37:19.000000000 +0200
 <at>  <at>  -77,7 +77,7  <at>  <at> 
     harness.check(tb.getTitleColor(), c);
     Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
     harness.check(tb.getTitleFont(), f);
-    harness.check(tb.getTitlePosition(), TitledBorder.TOP);
+    harness.check(tb.getTitlePosition(), TitledBorder.DEFAULT_POSITION);
     harness.check(tb.getTitleJustification(), TitledBorder.LEADING);

     tb = new TitledBorder((Border) null);
(Continue reading)

Dr Andrew John Hughes | 7 Sep 2011 04:38
Picon
Favicon

Re: RFC: fix for Mauve test javax/swing/Border/TitledBorder/constructors.java

On 17:33 Fri 02 Sep     , Pavel Tisnovsky wrote:
> Greetings,
> 
> here's fix for another Mauve test. In the test
> "javax/swing/Border/TitledBorder/constructors.java" the position of the title in
> the border should be compared with the constant TitledBorder.DEFAULT_POSITION,
> not with TitledBorder.TOP, at least in cases when following constructors are used:
> 
> TitledBorder(Border border)
> TitledBorder(Border border, String title)
> TitledBorder(String title)
> 
> (there exist three other constructors where title position can be explicitly
> specified, but the fix changes only test cases which use the previous three
> constructors).
> 

Can you explain why and note whether this affects current test results?

--

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
(Continue reading)

Pavel Tisnovsky | 7 Sep 2011 14:54
Picon
Favicon

Re: RFC: fix for Mauve test javax/swing/Border/TitledBorder/constructors.java

Dr Andrew John Hughes wrote:
> On 17:33 Fri 02 Sep     , Pavel Tisnovsky wrote:
>> Greetings,
>>
>> here's fix for another Mauve test. In the test
>> "javax/swing/Border/TitledBorder/constructors.java" the position of the title in
>> the border should be compared with the constant TitledBorder.DEFAULT_POSITION,
>> not with TitledBorder.TOP, at least in cases when following constructors are used:
>>
>> TitledBorder(Border border)
>> TitledBorder(Border border, String title)
>> TitledBorder(String title)
>>
>> (there exist three other constructors where title position can be explicitly
>> specified, but the fix changes only test cases which use the previous three
>> constructors).
>>
> 
> Can you explain why and note whether this affects current test results?
> 

Hi Andrew,

well, I've gone deeper into this issue and it seems, that GNU Classpath and
OpenJDK have quite different behaviour, but both are AFAIK correct due to
imprecise specification. When one of the following constructors are used to
create TitledBorder:

TitledBorder(Border border)
TitledBorder(Border border, String title)
(Continue reading)

Pavel Tisnovsky | 14 Sep 2011 10:57
Picon
Favicon

Re: RFC: fix for Mauve test javax/swing/Border/TitledBorder/constructors.java

Greetings,

here's the new version of a patch for a Mauve test
javax/swing/Border/TitledBorder/constructors.java. This patch make this test
work correctly on OpenJDK & GNU Classpath too:

--- mauve_old/gnu/testlet/javax/swing/border/TitledBorder/constructors.java
2006-02-01 15:14:22.000000000 +0100
+++ mauve_new/gnu/testlet/javax/swing/border/TitledBorder/constructors.java
2011-09-14 10:48:54.000000000 +0200
 <at>  <at>  -65,6 +65,11  <at>  <at> 
     test6(harness);
   }

+  public void checkTitledBorderDefaultPosition(TestHarness harness, int position)
+  {
+    harness.check(position == TitledBorder.TOP || position ==
TitledBorder.DEFAULT_POSITION);
+  }
+
   public void test1(TestHarness harness)
   {
     harness.checkPoint("(Border)");
 <at>  <at>  -77,7 +82,7  <at>  <at> 
     harness.check(tb.getTitleColor(), c);
     Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
     harness.check(tb.getTitleFont(), f);
-    harness.check(tb.getTitlePosition(), TitledBorder.TOP);
+    checkTitledBorderDefaultPosition(harness, tb.getTitlePosition());
     harness.check(tb.getTitleJustification(), TitledBorder.LEADING);
(Continue reading)

Mark Wielaard | 14 Sep 2011 11:11
Favicon
Gravatar

Re: RFC: fix for Mauve test javax/swing/Border/TitledBorder/constructors.java

On Wed, 2011-09-14 at 10:57 +0200, Pavel Tisnovsky wrote:
> here's the new version of a patch for a Mauve test
> javax/swing/Border/TitledBorder/constructors.java. This patch make this test
> work correctly on OpenJDK & GNU Classpath too:

IMHO you just found a bug in GNU Classpath. If no position is given it
should use DEFAULT_POSITION, not TOP. The test was wrong, and I think
your original fix was correct.

Cheers,

Mark


Gmane