use of android.text.Layout.Directions in project android_frameworks_base by ParanoidAndroid.
the class StaticLayoutDirectionsTest method checkDirections.
private void checkDirections(Layout l, int i, String text, Directions[] expectedDirs, Formatter f) {
Directions expected = expectedDirs[i];
Directions result = l.getLineDirections(0);
if (!Arrays.equals(expected.mDirections, result.mDirections)) {
f.format("%n[%2d] '%s', %s != %s", i, text, hexArray(expected.mDirections), hexArray(result.mDirections));
}
}
use of android.text.Layout.Directions in project android_frameworks_base by ParanoidAndroid.
the class StaticLayoutDirectionsTest method testTrailingWhitespace.
// @SmallTest
public void testTrailingWhitespace() {
LayoutBuilder b = StaticLayoutTest.builder();
b.setText(pseudoBidiToReal("Ab c"));
// exclude 'c'
float width = b.paint.measureText(b.text, 0, 5);
b.setWidth(Math.round(width));
Layout l = b.build();
if (l.getLineCount() != 2) {
throw new RuntimeException("expected 2 lines, got: " + l.getLineCount());
}
Directions result = l.getLineDirections(0);
Directions expected = dirs(0, LVL1_1, 1, LVL2_1, 2, 3 | (1 << Layout.RUN_LEVEL_SHIFT));
expectDirections("split line", expected, result);
}
use of android.text.Layout.Directions in project platform_frameworks_base by android.
the class StaticLayoutDirectionsTest method checkDirections.
private void checkDirections(Layout l, int i, String text, Directions[] expectedDirs, Formatter f) {
Directions expected = expectedDirs[i];
Directions result = l.getLineDirections(0);
if (!Arrays.equals(expected.mDirections, result.mDirections)) {
f.format("%n[%2d] '%s', %s != %s", i, text, hexArray(expected.mDirections), hexArray(result.mDirections));
}
}
use of android.text.Layout.Directions in project platform_frameworks_base by android.
the class StaticLayoutDirectionsTest method testTrailingWhitespace.
// @SmallTest
public void testTrailingWhitespace() {
LayoutBuilder b = StaticLayoutTest.builder();
b.setText(pseudoBidiToReal("Ab c"));
// exclude 'c'
float width = b.paint.measureText(b.text, 0, 5);
b.setWidth(Math.round(width));
Layout l = b.build();
if (l.getLineCount() != 2) {
throw new RuntimeException("expected 2 lines, got: " + l.getLineCount());
}
Directions result = l.getLineDirections(0);
Directions expected = dirs(0, LVL1_1, 1, LVL2_1, 2, 3 | (1 << Layout.RUN_LEVEL_SHIFT));
expectDirections("split line", expected, result);
}
use of android.text.Layout.Directions in project android_frameworks_base by DirtyUnicorns.
the class StaticLayoutDirectionsTest method testTrailingWhitespace.
// @SmallTest
public void testTrailingWhitespace() {
LayoutBuilder b = StaticLayoutTest.builder();
b.setText(pseudoBidiToReal("Ab c"));
// exclude 'c'
float width = b.paint.measureText(b.text, 0, 5);
b.setWidth(Math.round(width));
Layout l = b.build();
if (l.getLineCount() != 2) {
throw new RuntimeException("expected 2 lines, got: " + l.getLineCount());
}
Directions result = l.getLineDirections(0);
Directions expected = dirs(0, LVL1_1, 1, LVL2_1, 2, 3 | (1 << Layout.RUN_LEVEL_SHIFT));
expectDirections("split line", expected, result);
}
Aggregations