test/jdk/java/awt/font/GlyphVector/TestLayoutFlags.java
changeset 50137 941d432aee8b
parent 50134 6064cd8725fa
equal deleted inserted replaced
50136:2bdb78c5a858 50137:941d432aee8b
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 
    24 
    25 /* @test
    25 /* @test
    26    @bug 4328745 5090704 8166111 8176510
    26    @bug 4328745 5090704 8166111 8176510 8202767
    27    @summary exercise getLayoutFlags, getGlyphCharIndex, getGlyphCharIndices
    27    @summary exercise getLayoutFlags, getGlyphCharIndex, getGlyphCharIndices
    28  */
    28  */
    29 
    29 
    30 import java.awt.Font;
    30 import java.awt.Font;
    31 import static java.awt.Font.*;
    31 import static java.awt.Font.*;
    43     }
    43     }
    44 
    44 
    45     void runTest() {
    45     void runTest() {
    46 
    46 
    47         Font font = findFont("abcde");
    47         Font font = findFont("abcde");
       
    48         if (font == null) {
       
    49            return; // this system is no use for this test.
       
    50         }
    48 
    51 
    49         String latin1 = "This is a latin1 string"; // none
    52         String latin1 = "This is a latin1 string"; // none
    50         String hebrew = "\u05d0\u05d1\u05d2\u05d3"; // rtl
    53         String hebrew = "\u05d0\u05d1\u05d2\u05d3"; // rtl
    51         String arabic = "\u0646\u0644\u0622\u0646"; // rtl + mc/g
    54         String arabic = "\u0646\u0644\u0622\u0646"; // rtl + mc/g
    52         String hindi = "\u0939\u093f\u0923\u094d\u0921\u0940"; // ltr + reorder
    55         String hindi = "\u0939\u093f\u0923\u094d\u0921\u0940"; // ltr + reorder
   139                                       0, text.length(), flags);
   142                                       0, text.length(), flags);
   140     }
   143     }
   141 
   144 
   142     void test(String name, GlyphVector gv, boolean layout, int allowedFlags) {
   145     void test(String name, GlyphVector gv, boolean layout, int allowedFlags) {
   143 
   146 
       
   147         if (gv == null) {
       
   148             return;
       
   149         }
   144         int iv = (layout) ? FLAG_HAS_POSITION_ADJUSTMENTS : 0;
   150         int iv = (layout) ? FLAG_HAS_POSITION_ADJUSTMENTS : 0;
   145 
   151 
   146         int computedFlags = computeFlags(gv, iv) & gv.FLAG_MASK;
   152         int computedFlags = computeFlags(gv, iv) & gv.FLAG_MASK;
   147         int actualFlags = gv.getLayoutFlags() & gv.FLAG_MASK;
   153         int actualFlags = gv.getLayoutFlags() & gv.FLAG_MASK;
   148 
   154