DO NOT MERGE Some Holo Test Improvements
- Add a unique image per display bucket to tell what class of resources
the system is loading.
- Show width and height in dips
- Turn off hardware acceleration for emulator stability.
Change-Id: I59b8ee457e0350be9f9cbe5089f55ffeea38e913
diff --git a/tests/tests/holo/res/drawable-hdpi/display_info.png b/tests/tests/holo/res/drawable-hdpi/display_info.png
new file mode 100644
index 0000000..10b3950
--- /dev/null
+++ b/tests/tests/holo/res/drawable-hdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-land-hdpi/display_info.png b/tests/tests/holo/res/drawable-land-hdpi/display_info.png
new file mode 100644
index 0000000..a665018
--- /dev/null
+++ b/tests/tests/holo/res/drawable-land-hdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-land-ldpi/display_info.png b/tests/tests/holo/res/drawable-land-ldpi/display_info.png
new file mode 100644
index 0000000..64c8f3a
--- /dev/null
+++ b/tests/tests/holo/res/drawable-land-ldpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-land-mdpi/display_info.png b/tests/tests/holo/res/drawable-land-mdpi/display_info.png
new file mode 100644
index 0000000..f3e6765
--- /dev/null
+++ b/tests/tests/holo/res/drawable-land-mdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-land-tvdpi/display_info.png b/tests/tests/holo/res/drawable-land-tvdpi/display_info.png
new file mode 100644
index 0000000..99de970
--- /dev/null
+++ b/tests/tests/holo/res/drawable-land-tvdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-land-xhdpi/display_info.png b/tests/tests/holo/res/drawable-land-xhdpi/display_info.png
new file mode 100644
index 0000000..4c0c2b4
--- /dev/null
+++ b/tests/tests/holo/res/drawable-land-xhdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-ldpi/display_info.png b/tests/tests/holo/res/drawable-ldpi/display_info.png
new file mode 100644
index 0000000..af1fda5
--- /dev/null
+++ b/tests/tests/holo/res/drawable-ldpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-mdpi/display_info.png b/tests/tests/holo/res/drawable-mdpi/display_info.png
new file mode 100644
index 0000000..4378b14
--- /dev/null
+++ b/tests/tests/holo/res/drawable-mdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-hdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-hdpi/display_info.png
new file mode 100644
index 0000000..1e61b19
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-hdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-land-hdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-land-hdpi/display_info.png
new file mode 100644
index 0000000..123440e
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-land-hdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-land-ldpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-land-ldpi/display_info.png
new file mode 100644
index 0000000..7b8a0ad
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-land-ldpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-land-mdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-land-mdpi/display_info.png
new file mode 100644
index 0000000..e285898
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-land-mdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-land-tvdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-land-tvdpi/display_info.png
new file mode 100644
index 0000000..af4eaaa8
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-land-tvdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-land-xhdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-land-xhdpi/display_info.png
new file mode 100644
index 0000000..995af67
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-land-xhdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-ldpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-ldpi/display_info.png
new file mode 100644
index 0000000..4d9d810
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-ldpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-mdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-mdpi/display_info.png
new file mode 100644
index 0000000..b875d76
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-mdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-tvdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-tvdpi/display_info.png
new file mode 100644
index 0000000..6db0c61
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-tvdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-sw600dp-xhdpi/display_info.png b/tests/tests/holo/res/drawable-sw600dp-xhdpi/display_info.png
new file mode 100644
index 0000000..0ebb8c7
--- /dev/null
+++ b/tests/tests/holo/res/drawable-sw600dp-xhdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-tvdpi/display_info.png b/tests/tests/holo/res/drawable-tvdpi/display_info.png
new file mode 100644
index 0000000..d9825fb
--- /dev/null
+++ b/tests/tests/holo/res/drawable-tvdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/drawable-xhdpi/display_info.png b/tests/tests/holo/res/drawable-xhdpi/display_info.png
new file mode 100644
index 0000000..585af2f
--- /dev/null
+++ b/tests/tests/holo/res/drawable-xhdpi/display_info.png
Binary files differ
diff --git a/tests/tests/holo/res/layout/display_info.xml b/tests/tests/holo/res/layout/display_info.xml
index 130ce1f..9804b8c 100644
--- a/tests/tests/holo/res/layout/display_info.xml
+++ b/tests/tests/holo/res/layout/display_info.xml
@@ -13,8 +13,20 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
+ <ImageView
+ android:src="@drawable/display_info"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+ <TextView
android:id="@+id/text"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_height="wrap_content"
/>
+</LinearLayout>
+
diff --git a/tests/tests/holo/res/values/strings.xml b/tests/tests/holo/res/values/strings.xml
index 5eb7d82..d2f6fd6 100644
--- a/tests/tests/holo/res/values/strings.xml
+++ b/tests/tests/holo/res/values/strings.xml
@@ -24,7 +24,7 @@
<string name="task_clear_diff_bitmaps">Clear Diff Bitmaps</string>
<string name="display_info">Display Info</string>
- <string name="display_info_text">Density DPI: %1$d\nDensity Bucket: %2$s</string>
+ <string name="display_info_text">Density DPI: %1$d\nDensity Bucket: %2$s\nWidth DP: %3$d\nHeight DP: %4$d</string>
<string name="pick_theme">Pick Theme</string>
<string name="pick_layout">Pick Layout</string>
diff --git a/tests/tests/holo/src/android/holo/cts/DisplayInfoActivity.java b/tests/tests/holo/src/android/holo/cts/DisplayInfoActivity.java
index a11179a..bdd7925 100644
--- a/tests/tests/holo/src/android/holo/cts/DisplayInfoActivity.java
+++ b/tests/tests/holo/src/android/holo/cts/DisplayInfoActivity.java
@@ -37,9 +37,13 @@
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
+ DisplayMetrics dm = getResources().getDisplayMetrics();
+ int width = Math.round(dm.widthPixels / dm.density);
+ int height = Math.round(dm.heightPixels / dm.density);
+
TextView text = (TextView) findViewById(R.id.text);
text.setText(getString(R.string.display_info_text, metrics.densityDpi,
- getScreenDensityBucket(metrics)));
+ getScreenDensityBucket(metrics), width, height));
}
private String getScreenDensityBucket(DisplayMetrics metrics) {