summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Ford <kennethford@google.com>2023-11-03 17:07:36 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-11-03 17:07:36 +0000
commit252a95707245820cd0f5e0bdab292f2ca508cbe4 (patch)
tree69eb5a8f59f48726fb653e35e041de56f96de78f
parent7a6f43b2e44fcd559d6aca847631081a9358d7ec (diff)
parent9afb0f12a8444e4af9b5997959b1d5384165dd8b (diff)
downloadcts-252a95707245820cd0f5e0bdab292f2ca508cbe4.tar.gz
Merge "Update CTS for Android 14 CDD display requirements" into android14-tests-dev
-rw-r--r--tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
index 6cd292ac771..5f27a97a4e9 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
@@ -48,13 +48,20 @@ public class ConfigurationTest extends AndroidTestCase {
display.getRealMetrics(mMetrics);
}
+ @CddTest(requirement = "2.2.1")
@Presubmit
public void testScreenConfiguration() {
double xInches = (double) mMetrics.widthPixels / mMetrics.xdpi;
double yInches = (double) mMetrics.heightPixels / mMetrics.ydpi;
double diagonalInches = Math.sqrt(Math.pow(xInches, 2) + Math.pow(yInches, 2));
double minSize = 2.5d;
- if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.R) {
+ double minShortEdgeInches = 0.0d;
+ double minLongEdgeInches = 0.0d;
+ if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+ minSize = 4.04d;
+ minShortEdgeInches = 2.2d;
+ minLongEdgeInches = 3.4d;
+ } else if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.R) {
minSize = 3.3d;
}
if (FeatureUtil.isWatch()) {
@@ -64,8 +71,20 @@ public class ConfigurationTest extends AndroidTestCase {
// Cars have a different minimum diagonal.
minSize = 6.0d;
}
+
assertTrue("Screen diagonal must be at least " + minSize + " inches: " + diagonalInches,
diagonalInches >= minSize);
+ // We can only verify short and long edge screen dimensions on non watch and auto devices.
+ if (!FeatureUtil.isAutomotive() && !FeatureUtil.isWatch()) {
+ assertTrue(
+ "Screen short edge must be at least " + minShortEdgeInches + " inches: "
+ + Math.min(xInches, yInches),
+ Math.min(xInches, yInches) >= minShortEdgeInches);
+ assertTrue(
+ "Screen long edge must be at least " + minLongEdgeInches + " inches: "
+ + Math.max(xInches, yInches),
+ Math.max(xInches, yInches) >= minLongEdgeInches);
+ }
double density = 160.0d * mMetrics.density;
assertTrue("Screen density must be at least 100 dpi: " + density, density >= 100.0d);