Change TextView break strategy to meet Android Wear configuration.
The default break strategy of TextView should be
BREAK_STRATEGY_HIGH_QUALITY for all devices except for Android Wear.
The default break strategy of TextView on Android Wear should be
BREAK_STRATEGY_BALANCED.
Bug: 24195211
Change-Id: I9c419c4826a61be5c67393cb7a7f2128f0579d1e
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index 3130a26..01938c2 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -24,6 +24,7 @@
import android.app.Instrumentation;
import android.app.Instrumentation.ActivityMonitor;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Resources.NotFoundException;
import android.cts.util.PollingCheck;
@@ -4416,9 +4417,18 @@
public void testSetGetBreakStrategy() {
TextView tv = new TextView(mActivity);
+ final PackageManager pm = getInstrumentation().getTargetContext().getPackageManager();
+
// The default value is from the theme, here the default is BREAK_STRATEGY_HIGH_QUALITY for
- // TextView.
- assertEquals(Layout.BREAK_STRATEGY_HIGH_QUALITY, tv.getBreakStrategy());
+ // TextView except for Android Wear. The default value for Android Wear is
+ // BREAK_STRATEGY_BALANCED.
+ if (pm.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+ // Android Wear
+ assertEquals(Layout.BREAK_STRATEGY_BALANCED, tv.getBreakStrategy());
+ } else {
+ // All other form factor.
+ assertEquals(Layout.BREAK_STRATEGY_HIGH_QUALITY, tv.getBreakStrategy());
+ }
tv.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE);
assertEquals(Layout.BREAK_STRATEGY_SIMPLE, tv.getBreakStrategy());