MCPcopy Create free account
hub / github.com/JetBrains/skija / testCombining

Method testCombining

tests/java/TextLineTest.java:108–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106 }
107
108 public void testCombining() {
109 // u U+0075 LATIN SMALL LETTER U
110 // ̈ U+0308 COMBINING DIAERESIS
111 // a U+0061 LATIN SMALL LETTER A
112 // ̧ U+0327 COMBINING CEDILLA
113 try (TextLine line = TextLine.make("üa̧", inter36);) {
114 assertArrayEquals(new short[] {898 /* ü */, 503 /* a */, 1664 /* ̧ */}, line.getGlyphs());
115 assertArrayEquals(new int[] {0, 2, 4}, TextLine._nGetBreakOffsets(line._ptr));
116 assertArrayEquals(new float[] {0, 21, 41}, TextLine._nGetBreakPositions(line._ptr));
117
118 pushStack("getOffsetAtCoord");
119 assertEquals(0, line.getOffsetAtCoord(0f));
120 assertEquals(0, line.getOffsetAtCoord(10f));
121 assertEquals(2, line.getOffsetAtCoord(12f));
122 assertEquals(2, line.getOffsetAtCoord(21f));
123 assertEquals(2, line.getOffsetAtCoord(30f));
124 assertEquals(4, line.getOffsetAtCoord(32f));
125 assertEquals(4, line.getOffsetAtCoord(41f));
126 popStack();
127
128 pushStack("getCoordAtOffset");
129 assertClose(0, line.getCoordAtOffset(0));
130 assertClose(0, line.getCoordAtOffset(1));
131 assertClose(21, line.getCoordAtOffset(2));
132 assertClose(41, line.getCoordAtOffset(3));
133 assertClose(41, line.getCoordAtOffset(4));
134 popStack();
135 }
136
137 // a U+0061 LATIN SMALL LETTER A
138 // ̆ U+0306 COMBINING BREVE
139 try (TextLine line = TextLine.make("ă", jbMono36);) {
140 // JetBrains Mono supports “a” and “ă” but not “ ̆ ” separately
141 // assertArrayEquals(new short[] {226 /* ă */}, line.getGlyphs()); // FIXME #106
142 }
143
144 // a U+0061 LATIN SMALL LETTER A
145 // a U+0061 LATIN SMALL LETTER A
146 // ̧ U+0327 COMBINING CEDILLA
147 try (TextLine line = TextLine.make("aa̧", jbMono36);) {
148 // JetBrains Mono supports “a” but not “ ̧ ”
149 // Second grapheme cluster should fall back together, second “a” should resolve to different glyph
150 assertNotEquals(line.getGlyphs()[0], line.getGlyphs()[1]);
151 }
152 }
153
154 public void testEmoji() {
155 try (TextLine misc = TextLine.make("☺", firaCode36); // U+263A, in Fira Code

Callers 1

executeMethod · 0.95

Calls 12

makeMethod · 0.95
_nGetBreakOffsetsMethod · 0.95
_nGetBreakPositionsMethod · 0.95
assertArrayEqualsMethod · 0.80
pushStackMethod · 0.80
assertEqualsMethod · 0.80
getOffsetAtCoordMethod · 0.80
popStackMethod · 0.80
assertCloseMethod · 0.80
getCoordAtOffsetMethod · 0.80
assertNotEqualsMethod · 0.80
getGlyphsMethod · 0.45

Tested by

no test coverage detected