Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4179078

java.awt.Font.GetMaxCharBounds returns a different font size

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 1.2.0, 1.2.1
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
      2d
    • Introduced In Build:
      1.2fcs
    • Introduced In Version:
    • CPU:
      generic
    • OS:
      generic, solaris_2.5

      Description

      This test fails on 1.2 JDK build "L". jtr file output is:
      #Test Results
      #Tue Oct 06 00:43:07 PDT 1998
      testsuite=/usr/re/jck1.2/src/solaris/JCK-12a/unzip-test/JCK-12a/tests
      source=GetMaxCharBoundsTest.java
      executeClass=javasoft.sqe.tests.api.java.awt.java2d.awt.Font.GetMaxCharBoundsTest
      title=Font.getMaxCharBounds(FontRenderContext)
      status=Failed. tests: 6; passed: 2; failed: 4; first test case failure: 1:0
      work=/usr/re/jck1.2/src/solaris/JCK-12a/unzip-test/runtime-batch-multiJVM/work/api/java_awt/java2d/awt/Font
      execStatus=Failed. tests: 6; passed: 2; failed: 4; first test case failure: 1:0
      description=file:/usr/re/jck1.2/src/solaris/JCK-12a/unzip-test/JCK-12a/tests/api/java_awt/java2d/awt/Font/index.html#GetMaxCharBoundsTest
      id=GetMaxCharBoundsTest
      name=GetMaxCharBoundsTest
      javatestVersion=JT_2.0_zf
      sections=testExecute testExecute
      file=/usr/re/jck1.2/src/solaris/JCK-12a/unzip-test/JCK-12a/tests/api/java_awt/java2d/awt/Font/index.html
      end=Tue Oct 06 00:43:06 PDT 1998
      start=Tue Oct 06 00:43:03 PDT 1998
      keywords=positive runtime
      environment=jck-runtime-solaris
      timeout=60
      executeArgs=

      test: api/java_awt/java2d/awt/Font/index.html#GetMaxCharBoundsTest
      script: javasoft.sqe.javatest.lib.JCKScript -runtime
      Executing test class...
      command: javasoft.sqe.javatest.lib.ExecJCKTestOtherJVMCmd CLASSPATH=/usr/re/jck1.2/src/solaris/JCK-12a/unzip-test/JCK-12a/tests/../classe
      s:/usr/re/jck1.2/src/solaris/JCK-12a/unzip-test/JCK-12a/javatest.jar DISPLAY=mizu:0.0 HOME=/home/wnelson LD_LIBRARY_PATH=/usr/re/jck1.2/s
      rc/solaris/JCK-12a/unzip-test/JCK-12a/tests/../lib /java/jck/jdk1.2/fcs_L/solaris/bin/java -verify javasoft.sqe.tests.api.java.awt.java2d
      .awt.Font.GetMaxCharBoundsTest
      ----------ref:testExecute(38/2231)----------
      ----------------------------------------------------------------
                     AssertionTest Report
      ----------------------------------------------------------------
       Method Name : public java.awt.geom.Rectangle2D java.awt.Font.getMaxCharBounds(java.awt.font.FontRenderContext)
       Class Name : class java.awt.Font
      ----------------------------------------------------------------
      --------------------------------------------------------------
       Index of factory objects : 1:0
       List of Assertion Failures:
        - The MaxCharBounds should be slightly larger than the size but got width = 10.0 is less than given size = 10
       Test Status : Assertion Failed
      --------------------------------------------------------------
      --------------------------------------------------------------
       Index of factory objects : 1:1
       List of Assertion Failures:
        - The MaxCharBounds should be slightly larger than the size but got width = 9.9945068359375 is less than given size = 10
       Test Status : Assertion Failed
      --------------------------------------------------------------
      --------------------------------------------------------------
       Index of factory objects : 2:0
       List of Assertion Failures:
        - The MaxCharBounds should be slightly larger than the size but got width = 13.0 is less than given size = 13
       Test Status : Assertion Failed
      --------------------------------------------------------------
      --------------------------------------------------------------
       Index of factory objects : 2:1
       List of Assertion Failures:
        - The MaxCharBounds should be slightly larger than the size but got width = 12.9852294921875 is less than given size = 13
       Test Status : Assertion Failed
      --------------------------------------------------------------
      --------------------------------------------------------------------
                     Overall AssertionTest Result Summary
      --------------------------------------------------------------------
       Overall Test Status : Failed
       Total Number of Tests : 6
       Total Tests Passed : 2
       Total Tests Failed : 4
      --------------------------------------------------------------------
      ----------log:testExecute(1/75)----------
      STATUS:Failed.tests: 6; passed: 2; failed: 4; first test case failure: 1:0
      command result: Failed. tests: 6; passed: 2; failed: 4; first test case failure: 1:0
      test result: Failed. tests: 6; passed: 2; failed: 4; first test case failure: 1:0


      Name: krT82822 Date: 09/19/99


      *** This problem must be fixed before our internal applications
       can migrate to jdk1.2 ***

      This problem is reproducible on our platform (ptx) and on our
      SunOS x86 platform. The text is truncated because the length
      calculation for the text is incorrect. It's not as obvious,
      but the height calculation is also incorrect. The problem
      appears with both TrueType and Type1 fonts.

      This program runs correctly using jdk1.1.7.

      This problem appears to be similar to bugs #4179078, #4165108,
      #4157044 and #4244848, among others. Some of these have been
      closed as non-reproducible.

      /*
      9/19/99 eval1127@eng -- 4244848 (not reproducible), 4179078 (accepted), 4165108 (closed fixed UNverified for 1.2, so either not fixed or not same problem),
      4157044 (fixed verified for 1.2, so not same root cause)
      */

      The following program will reproduce the problem:

      import java.awt.*;

      public class font1 extends Panel {
              font1Label lab;
              public font1() {
                      super();
                      lab = new font1Label("This is a font test.");
                      add(lab);
              }

              public static void main(String[] args) {
                      Frame f = new Frame("Font Test 1");
                      f.setSize(400, 400);
                      font1 p = new font1();
                      f.add(p);
                      f.show();
              }
      }

      class font1Label extends Label {
              int line_width, line_height;

              public font1Label(String s) {
                      super(s);
      // Font stdBold = new Font( "SansSerif", Font.BOLD, 12);
                      Font stdBold = new Font( "Utopia", Font.BOLD, 12);
      // Font stdBold = new Font( "CourierNew", Font.BOLD, 12);
                      setFont(stdBold);
                      FontMetrics fm = getFontMetrics(stdBold);
                      System.err.println(fm);

                      line_height = fm.getHeight();
                      line_width = fm.stringWidth(s);
                      System.err.println("line_height = " + line_height);
                      System.err.println("line_width = " + line_width);
              }

              public Dimension getSize() {
                      return( new Dimension( line_width, line_height ));
              }

              /**
               * Return the minimum size of the VLabel.
               * @return the minimum size of the object, which is the same as
               * the preferred size.
               */
              public Dimension getMinimumSize() {
                      return getSize();
              }

              /**
               * Return the preferred size of the VLabel
               * @return the preferred size of the object, which is the same as.
               * the minimum size.
               */
              public Dimension getPreferredSize() {
                      return getSize();
              }
      }
      (Review ID: 95301)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            pkejriwasunw Parry Kejriwal (Inactive)
            Reporter:
            sflemingsunw Steve Fleming (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: