author | prr |
Tue, 20 Dec 2016 09:47:22 -0800 | |
changeset 43072 | 6f7769361c22 |
parent 31660 | 1a4e2e5c15e1 |
permissions | -rw-r--r-- |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
1 |
/* |
43072
6f7769361c22
8166111: [PIT] possible regression: java/awt/font/GlyphVector/TestLayoutFlags.java
prr
parents:
31660
diff
changeset
|
2 |
* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
4 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
8 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
13 |
* accompanied this code). |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
14 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
18 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
21 |
* questions. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
22 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
23 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
24 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
25 |
/* @test |
43072
6f7769361c22
8166111: [PIT] possible regression: java/awt/font/GlyphVector/TestLayoutFlags.java
prr
parents:
31660
diff
changeset
|
26 |
@bug 4328745 5090704 8166111 |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
27 |
@summary exercise getLayoutFlags, getGlyphCharIndex, getGlyphCharIndices |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
28 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
29 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
30 |
import java.awt.*; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
31 |
import java.awt.event.*; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
32 |
import java.awt.font.*; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
33 |
import java.awt.geom.*; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
34 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
35 |
public class TestLayoutFlags { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
36 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
37 |
static public void main(String[] args) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
38 |
new TestLayoutFlags().runTest(); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
39 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
40 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
41 |
void runTest() { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
42 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
43 |
Font font = new Font("Lucida Sans", Font.PLAIN, 24); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
44 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
45 |
String latin1 = "This is a latin1 string"; // none |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
46 |
String hebrew = "\u05d0\u05d1\u05d2\u05d3"; // rtl |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
47 |
String arabic = "\u0646\u0644\u0622\u0646"; // rtl + mc/g |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
48 |
String hindi = "\u0939\u093f\u0923\u094d\u0921\u0940"; // ltr + reorder |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
49 |
// String tamil = "\u0b9c\u0bcb"; // ltr + mg/c + split |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
50 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
51 |
FontRenderContext frc = new FontRenderContext(null, true, true); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
52 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
53 |
// get glyph char indices needs to initializes layoutFlags before use (5090704) |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
54 |
{ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
55 |
GlyphVector gv = font.createGlyphVector(frc, "abcde"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
56 |
int ix = gv.getGlyphCharIndex(0); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
57 |
if (ix != 0) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
58 |
throw new Error("glyph 0 incorrectly mapped to char " + ix); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
59 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
60 |
int[] ixs = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
61 |
for (int i = 0; i < ixs.length; ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
62 |
if (ixs[i] != i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
63 |
throw new Error("glyph " + i + " incorrectly mapped to char " + ixs[i]); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
64 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
65 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
66 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
67 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
68 |
GlyphVector latinGV = makeGlyphVector("Lucida Sans", frc, latin1, false, 1 /* ScriptRun.LATIN */); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
69 |
GlyphVector hebrewGV = makeGlyphVector("Lucida Sans", frc, hebrew, true, 5 /* ScriptRun.HEBREW */); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
70 |
GlyphVector arabicGV = makeGlyphVector("Lucida Sans", frc, arabic, true, 6 /* ScriptRun.ARABIC */); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
71 |
GlyphVector hindiGV = makeGlyphVector("Lucida Sans", frc, hindi, false, 7 /* ScriptRun.DEVANAGARI */); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
72 |
// GlyphVector tamilGV = makeGlyphVector("Devanagari MT for IBM", frc, tamil, false, 12 /* ScriptRun.TAMIL */); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
73 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
74 |
GlyphVector latinPos = font.createGlyphVector(frc, latin1); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
75 |
Point2D pt = latinPos.getGlyphPosition(0); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
76 |
pt.setLocation(pt.getX(), pt.getY() + 1.0); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
77 |
latinPos.setGlyphPosition(0, pt); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
78 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
79 |
GlyphVector latinTrans = font.createGlyphVector(frc, latin1); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
80 |
latinTrans.setGlyphTransform(0, AffineTransform.getRotateInstance(.15)); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
81 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
82 |
test("latin", latinGV, GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
83 |
test("hebrew", hebrewGV, GlyphVector.FLAG_RUN_RTL | |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
84 |
GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); |
43072
6f7769361c22
8166111: [PIT] possible regression: java/awt/font/GlyphVector/TestLayoutFlags.java
prr
parents:
31660
diff
changeset
|
85 |
test("arabic", arabicGV, GlyphVector.FLAG_COMPLEX_GLYPHS | |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
86 |
GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
87 |
test("hindi", hindiGV, GlyphVector.FLAG_COMPLEX_GLYPHS | |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
88 |
GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
89 |
// test("tamil", tamilGV, GlyphVector.FLAG_COMPLEX_GLYPHS); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
90 |
test("pos", latinPos, GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
91 |
test("trans", latinTrans, GlyphVector.FLAG_HAS_TRANSFORMS); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
92 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
93 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
94 |
GlyphVector makeGlyphVector(String fontname, FontRenderContext frc, String text, boolean rtl, int script) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
95 |
Font font = new Font(fontname, Font.PLAIN, 14); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
96 |
System.out.println("asking for " + fontname + " and got " + font.getFontName()); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
97 |
int flags = rtl ? 1 : 0; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
98 |
return font.layoutGlyphVector(frc, text.toCharArray(), 0, text.length(), flags); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
99 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
100 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
101 |
void test(String name, GlyphVector gv, int expectedFlags) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
102 |
expectedFlags &= gv.FLAG_MASK; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
103 |
int computedFlags = computeFlags(gv) & gv.FLAG_MASK; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
104 |
int actualFlags = gv.getLayoutFlags() & gv.FLAG_MASK; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
105 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
106 |
System.out.println("\n*** " + name + " ***"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
107 |
System.out.println(" test flags"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
108 |
System.out.print("expected "); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
109 |
printFlags(expectedFlags); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
110 |
System.out.print("computed "); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
111 |
printFlags(computedFlags); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
112 |
System.out.print(" actual "); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
113 |
printFlags(actualFlags); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
114 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
115 |
if (expectedFlags != actualFlags) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
116 |
throw new Error("layout flags in test: " + name + |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
117 |
" expected: " + Integer.toHexString(expectedFlags) + |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
118 |
" but got: " + Integer.toHexString(actualFlags)); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
119 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
120 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
121 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
122 |
static public void printFlags(int flags) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
123 |
System.out.print("flags:"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
124 |
if ((flags & GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS) != 0) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
125 |
System.out.print(" pos"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
126 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
127 |
if ((flags & GlyphVector.FLAG_HAS_TRANSFORMS) != 0) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
128 |
System.out.print(" trans"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
129 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
130 |
if ((flags & GlyphVector.FLAG_RUN_RTL) != 0) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
131 |
System.out.print(" rtl"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
132 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
133 |
if ((flags & GlyphVector.FLAG_COMPLEX_GLYPHS) != 0) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
134 |
System.out.print(" complex"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
135 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
136 |
if ((flags & GlyphVector.FLAG_MASK) == 0) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
137 |
System.out.print(" none"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
138 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
139 |
System.out.println(); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
140 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
141 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
142 |
int computeFlags(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
143 |
validateCharIndexMethods(gv); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
144 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
145 |
int result = 0; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
146 |
if (glyphsAreRTL(gv)) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
147 |
result |= GlyphVector.FLAG_RUN_RTL; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
148 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
149 |
if (hasComplexGlyphs(gv)) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
150 |
result |= GlyphVector.FLAG_COMPLEX_GLYPHS; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
151 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
152 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
153 |
return result; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
154 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
155 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
156 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
157 |
* throw an exception if getGlyphCharIndices returns a different result than |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
158 |
* you get from iterating through getGlyphCharIndex one at a time. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
159 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
160 |
void validateCharIndexMethods(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
161 |
int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
162 |
for (int i = 0; i < gv.getNumGlyphs(); ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
163 |
if (gv.getGlyphCharIndex(i) != indices[i]) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
164 |
throw new Error("glyph index mismatch at " + i); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
165 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
166 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
167 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
168 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
169 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
170 |
* Return true if the glyph indices are pure ltr |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
171 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
172 |
boolean glyphsAreLTR(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
173 |
int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
174 |
for (int i = 0; i < indices.length; ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
175 |
if (indices[i] != i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
176 |
return false; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
177 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
178 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
179 |
return true; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
180 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
181 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
182 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
183 |
* Return true if the glyph indices are pure rtl |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
184 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
185 |
boolean glyphsAreRTL(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
186 |
int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
187 |
for (int i = 0; i < indices.length; ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
188 |
if (indices[i] != indices.length - i - 1) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
189 |
return false; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
190 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
191 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
192 |
return true; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
193 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
194 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
195 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
196 |
* Return true if there is a local reordering (the run is not ltr or rtl). |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
197 |
* !!! We can't have mixed bidi runs in the glyphs. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
198 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
199 |
boolean hasComplexGlyphs(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
200 |
return !glyphsAreLTR(gv) && !glyphsAreRTL(gv); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
201 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
202 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
203 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
204 |
/* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
205 |
rect getPixelBounds(frc, x, y) |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
206 |
rect getGlyphPixelBounds(frc, int, x, y) |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
207 |
getGlyphOutline(int index, x, y) |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
208 |
getGlyphInfo() |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
209 |
*/ |