public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Pavel Tisnovsky <ptisnovs@redhat.com>
To: Dr Andrew John Hughes <ahughes@redhat.com>
Cc: mauve-discuss@sourceware.org
Subject: Re: RFC: fix for Mauve test javax/swing/Border/TitledBorder/constructors.java
Date: Wed, 07 Sep 2011 12:53:00 -0000	[thread overview]
Message-ID: <4E6769A0.8020906@redhat.com> (raw)
In-Reply-To: <20110907023849.GI19081@rivendell.middle-earth.co.uk>

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)
TitledBorder(String title)

the text position is considered as DEFAULT_POSITION which * is equals * to TOP.
The only difference between GNU Classpath / OpenJDK is that GNU Classpath
explicitly sets text position to TOP in the constructor's body:

public TitledBorder(String title)
{
     this(/* border */ null, title, LEADING, TOP, /* titleFont */ null, /*
titleColor */ null);
}

but OpenJDK still stores DEFAULT_POSITION in following types of code:

switch (position) {
   case TOP:
   case DEFAULT:
       the same code block for TOP & DEFAULT

(the same pattern are used for text justification, ie for constants LEFT and
DEFAULT_JUSTIFICATION).

This means that TitledBorder("title").getTitlePosition()==TitledBorder.TOP on
GNU Classpath but
TitledBorder("title").getTitlePosition()==TitledBorder.DEFAULT_POSITION on
OpenJDK and proprietary JDKs too.

So it's IMHO better to change the test to check for both possibilities.

Pavel

  reply	other threads:[~2011-09-07 12:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02 15:31 Pavel Tisnovsky
2011-09-07  2:39 ` Dr Andrew John Hughes
2011-09-07 12:53   ` Pavel Tisnovsky [this message]
2011-09-14  8:55     ` Pavel Tisnovsky
2011-09-14  9:11       ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E6769A0.8020906@redhat.com \
    --to=ptisnovs@redhat.com \
    --cc=ahughes@redhat.com \
    --cc=mauve-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).