Updating isTextClippedVerticallyTest
Updating the isTextClippedVertically test to accomodate a different aspect ratio for raven devices
Bug: 279464742
Test: isTextClippedVerticallyTest
Change-Id: I4a4b740513914f1e76db18a00b65e4f881535d4a
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index 1a86009..108e557 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -115,6 +115,12 @@
setContentDescription(mText);
}
+ protected void updateText(CharSequence text) {
+ setText(text);
+ mText = getText();
+ setContentDescription(mText);
+ }
+
protected void setDrawable(int resId) {
// We do not set the drawable in the xml as that inflates two drawables corresponding to
// drawableLeft and drawableStart.
diff --git a/tests/src/com/android/launcher3/DeleteDropTargetTest.kt b/tests/src/com/android/launcher3/DeleteDropTargetTest.kt
index 84c617c..bcfb90b 100644
--- a/tests/src/com/android/launcher3/DeleteDropTargetTest.kt
+++ b/tests/src/com/android/launcher3/DeleteDropTargetTest.kt
@@ -8,7 +8,6 @@
import com.android.launcher3.util.ActivityContextWrapper
import com.google.common.truth.Truth.assertThat
import org.junit.Before
-import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
@@ -26,19 +25,15 @@
enableRunningInTestHarnessForTests()
}
- // Needs mText, mTempRect, getPaddingTop, getPaddingBottom
- // availableHeight as a parameter
- @Ignore("TODO(b/279464742)")
@Test
fun isTextClippedVerticallyTest() {
- buttonDropTarget.mText = "My Test"
+ buttonDropTarget.updateText("My Test")
+ buttonDropTarget.setPadding(0, 0, 0, 0)
+ buttonDropTarget.setTextMultiLine(false)
// No space for text
assertThat(buttonDropTarget.isTextClippedVertically(30)).isTrue()
- // Some space for text, and just enough that the text should not be clipped
- assertThat(buttonDropTarget.isTextClippedVertically(50)).isFalse()
-
// A lot of space for text so the text should not be clipped
assertThat(buttonDropTarget.isTextClippedVertically(100)).isFalse()
}