jdk/test/javax/swing/text/WrappedPlainView/6857057/bug6857057.java
author ohair
Thu, 09 Sep 2010 16:26:46 -0700
changeset 6374 e214162c907e
parent 5762 6b50a6f25d81
permissions -rw-r--r--
6982137: Rebranding pass 2 - missed copyright changes Reviewed-by: mbykov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5762
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     1
/*
6374
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5762
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5762
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     4
 *
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     8
 *
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    13
 * accompanied this code).
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    14
 *
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    18
 *
6374
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5762
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5762
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5762
diff changeset
    21
 * questions.
5762
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    22
 */
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    23
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    24
/*
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    25
 * @test
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    26
 * @bug 6857057
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    27
 * @summary test that the JCK GlyphView2021 test doesn't fail
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    28
 * @author Sergey Groznyh
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    29
 * @run main bug6857057
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    30
 */
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    31
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    32
import javax.swing.*;
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    33
import javax.swing.text.Element;
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    34
import javax.swing.text.GlyphView;
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    35
import javax.swing.text.View;
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    36
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    37
public class bug6857057 {
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    38
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    39
    bug6857057() {
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    40
        Element elem = new StubBranchElement(" G L Y P H V");
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    41
        GlyphView view = new GlyphView(elem);
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    42
        float pos = elem.getStartOffset();
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    43
        float len = elem.getEndOffset() - pos;
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    44
        int res = view.getBreakWeight(View.X_AXIS, pos, len);
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    45
        if (res != View.ExcellentBreakWeight) {
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    46
            throw new RuntimeException("breakWeight != ExcellentBreakWeight");
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    47
        }
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    48
    }
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    49
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    50
    public static void main(String[] args) throws Throwable {
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    51
        SwingUtilities.invokeLater(new Runnable() {
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    52
            public void run() {
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    53
                new bug6857057();
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    54
            }
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    55
        });
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    56
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    57
        System.out.println("OK");
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    58
    }
6b50a6f25d81 6857057: api/javax_swing/text/GlyphView/index.html#Methods test fails
rupashka
parents:
diff changeset
    59
}