Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c730d2f6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix canvas crash in CanvasDrawTextTest"

parents f4732f21 f61ce18e
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -53,19 +53,19 @@ public class CanvasDrawTextTest {
        final String text = mTextUtil.nextRandomParagraph(
                WORD_LENGTH, 4 * 1024 * 1024 /* 4mb text */).toString();
        final RenderNode node = RenderNode.create("benchmark", null);
        final RenderNode child = RenderNode.create("child", null);
        child.setLeftTopRightBottom(50, 50, 100, 100);

        RecordingCanvas canvas = node.start(100, 100);
        node.end(canvas);
        canvas = child.start(50, 50);
        child.end(canvas);

        final Random r = new Random(0);

        while (state.keepRunning()) {
            state.pauseTiming();
            RecordingCanvas canvas = node.beginRecording();
            int start = r.nextInt(text.length() - 100);
            state.resumeTiming();

            canvas.drawText(text, start, start + 100, 0, 0, PAINT);

            state.pauseTiming();
            node.endRecording();
            state.resumeTiming();
        }
    }
}