Add test case for different text direction.

Bug: 113635044
Test: StaticLayoutPerfTest
Change-Id: I74f42bfc25aff25bfc1783ad0977b92526c87ef6
This commit is contained in:
Seigo Nonaka
2018-11-16 09:05:14 -08:00
parent 4445345f20
commit 1debe9a305

View File

@@ -168,6 +168,25 @@ public class StaticLayoutPerfTest {
}
}
@Test
public void testCreate_PrecomputedText_NoStyled_Greedy_NoHyphenation_DirDifferent() {
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
state.pauseTiming();
final PrecomputedText text = makeMeasured(
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), PAINT,
Layout.BREAK_STRATEGY_SIMPLE, Layout.HYPHENATION_FREQUENCY_NONE);
Canvas.freeTextLayoutCaches();
state.resumeTiming();
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH)
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
.setTextDirection(TextDirectionHeuristics.RTL)
.build();
}
}
@Test
public void testCreate_PrecomputedText_NoStyled_Greedy_Hyphenation() {
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();