diff options
| author | Roozbeh Pournader <roozbeh@google.com> | 2017-05-17 14:24:02 -0700 |
|---|---|---|
| committer | Roozbeh Pournader <roozbeh@google.com> | 2017-05-23 16:18:58 -0700 |
| commit | fc77869ee06c05eb5b7deea74e5ad31bd89a85bd (patch) | |
| tree | 1a206345152f1f543ecd909d43133a836a3e7ba9 /core/java/android/text/DynamicLayout.java | |
| parent | 7ed8a5796465bb87d03bf81e5882d31cfb16d21d (diff) | |
Set up empty lines for DynamicLayout#updateBlocks() tests
The changes in I666da5eeb39f780c341597f347bfcba21eb34295 introduced
the concept of lines that need to be always redrawn, but it broke
tests for DynamicLayout#updateBlocks() that didn't need to set up the
actual lines.
Now, during the test setup, we insert empty lines to match the number
of lines needed.
Test: adb shell am instrument -w -e class android.text.DynamicLayoutBlocksTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w -e class android.text.DynamicLayoutTest#testGetBlocksAlwaysNeedToBeRedrawn_thai com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w -e class android.text.DynamicLayoutTest#testGetBlocksAlwaysNeedToBeRedrawn_en com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Change-Id: I4bfc82db4beef1b740433a25a3ae29201f54d9d3
Fixes: 38029583
Diffstat (limited to 'core/java/android/text/DynamicLayout.java')
| -rw-r--r-- | core/java/android/text/DynamicLayout.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/text/DynamicLayout.java b/core/java/android/text/DynamicLayout.java index 6208c532295a..c7a5fce26c3e 100644 --- a/core/java/android/text/DynamicLayout.java +++ b/core/java/android/text/DynamicLayout.java @@ -491,8 +491,6 @@ public class DynamicLayout extends Layout * An index is associated to each block (which will be used by display lists), * this class simply invalidates the index of blocks overlapping a modification. * - * This method is package private and not private so that it can be tested. - * * @param startLine the first line of the range of modified lines * @param endLine the last line of the range, possibly equal to startLine, lower * than getLineCount() @@ -613,16 +611,20 @@ public class DynamicLayout extends Layout } /** - * This package private method is used for test purposes only + * This method is used for test purposes only. * @hide */ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) - public void setBlocksDataForTest(int[] blockEndLines, int[] blockIndices, int numberOfBlocks) { + public void setBlocksDataForTest(int[] blockEndLines, int[] blockIndices, int numberOfBlocks, + int totalLines) { mBlockEndLines = new int[blockEndLines.length]; mBlockIndices = new int[blockIndices.length]; System.arraycopy(blockEndLines, 0, mBlockEndLines, 0, blockEndLines.length); System.arraycopy(blockIndices, 0, mBlockIndices, 0, blockIndices.length); mNumberOfBlocks = numberOfBlocks; + while (mInts.size() < totalLines) { + mInts.insertAt(mInts.size(), new int[COLUMNS_NORMAL]); + } } /** |
