diff options
author | Gilles Debunne <debunne@google.com> | 2012-03-14 17:40:42 -0700 |
---|---|---|
committer | Gilles Debunne <debunne@google.com> | 2012-03-26 16:39:25 -0700 |
commit | 1e130b2abc051081982b5a793a18a28376c945e4 (patch) | |
tree | f30016b29695188e8a120965b06ecd117c153bdf /core/java/android/text | |
parent | 80e4ee46008d2817dc0496e0cf8c9470c6851755 (diff) | |
download | frameworks_base-1e130b2abc051081982b5a793a18a28376c945e4.zip frameworks_base-1e130b2abc051081982b5a793a18a28376c945e4.tar.gz frameworks_base-1e130b2abc051081982b5a793a18a28376c945e4.tar.bz2 |
Added a unit test for DynamicLayout#updateBlocks
Change-Id: I1824ebeae2bbb5c60a65de36fe1696bf003347c9
Diffstat (limited to 'core/java/android/text')
-rw-r--r-- | core/java/android/text/DynamicLayout.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/core/java/android/text/DynamicLayout.java b/core/java/android/text/DynamicLayout.java index 5f2d642..ff5a467 100644 --- a/core/java/android/text/DynamicLayout.java +++ b/core/java/android/text/DynamicLayout.java @@ -378,12 +378,16 @@ 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() * @param newLineCount the number of lines that will replace the range, possibly 0 + * + * @hide */ - private void updateBlocks(int startLine, int endLine, int newLineCount) { + void updateBlocks(int startLine, int endLine, int newLineCount) { int firstBlock = -1; int lastBlock = -1; for (int i = 0; i < mNumberOfBlocks; i++) { @@ -466,6 +470,18 @@ public class DynamicLayout extends Layout } /** + * This package private method is used for test purposes only + * @hide + */ + void setBlocksDataForTest(int[] blockEnds, int[] blockIndices, int numberOfBlocks) { + mBlockEnds = new int[blockEnds.length]; + mBlockIndices = new int[blockIndices.length]; + System.arraycopy(blockEnds, 0, mBlockEnds, 0, blockEnds.length); + System.arraycopy(blockIndices, 0, mBlockIndices, 0, blockIndices.length); + mNumberOfBlocks = numberOfBlocks; + } + + /** * @hide */ public int[] getBlockEnds() { |