From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26500 invoked by alias); 7 Sep 2011 12:53:16 -0000 Received: (qmail 26490 invoked by uid 22791); 7 Sep 2011 12:53:14 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Sep 2011 12:52:56 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p87Cquhx014093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 7 Sep 2011 08:52:56 -0400 Received: from dhcp-lab-190.englab.brq.redhat.com (dhcp-2-245.brq.redhat.com [10.34.2.245]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p87CqsTC001153; Wed, 7 Sep 2011 08:52:55 -0400 Message-ID: <4E6769A0.8020906@redhat.com> Date: Wed, 07 Sep 2011 12:53:00 -0000 From: Pavel Tisnovsky User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: Dr Andrew John Hughes CC: mauve-discuss@sourceware.org Subject: Re: RFC: fix for Mauve test javax/swing/Border/TitledBorder/constructors.java References: <4E60F752.1070308@redhat.com> <20110907023849.GI19081@rivendell.middle-earth.co.uk> In-Reply-To: <20110907023849.GI19081@rivendell.middle-earth.co.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2011-q3/txt/msg00018.txt.bz2 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