Merge "DO NOT MERGE - Added a simple test for new attributes of Display." into mnc-dev
diff --git a/tests/tests/display/src/android/display/cts/DisplayTest.java b/tests/tests/display/src/android/display/cts/DisplayTest.java
index bea99ed..c168921 100644
--- a/tests/tests/display/src/android/display/cts/DisplayTest.java
+++ b/tests/tests/display/src/android/display/cts/DisplayTest.java
@@ -26,8 +26,8 @@
 import android.view.WindowManager;
 
 public class DisplayTest extends AndroidTestCase {
-    // This test is called from DisplayTestRunner which brings up an overlay display on the target
-    // device. The overlay display parameters must match the ones defined there which are
+    // The CTS package brings up an overlay display on the target device (see AndroidTest.xml).
+    // The overlay display parameters must match the ones defined there which are
     // 181x161/214 (wxh/dpi).  It only matters that these values are different from any real
     // display.
 
@@ -177,4 +177,17 @@
 
         assertEquals(Display.FLAG_PRESENTATION, display.getFlags());
     }
+
+    /**
+     * Tests that the mode-related attributes and methods work as expected.
+     */
+    public void testMode() {
+        Display display = getSecondaryDisplay(mDisplayManager.getDisplays());
+        assertEquals(1, display.getSupportedModes().length);
+        Display.Mode mode = display.getMode();
+        assertEquals(display.getSupportedModes()[0], mode);
+        assertEquals(SECONDARY_DISPLAY_WIDTH, mode.getPhysicalWidth());
+        assertEquals(SECONDARY_DISPLAY_HEIGHT, mode.getPhysicalHeight());
+        assertEquals(display.getRefreshRate(), mode.getRefreshRate());
+    }
 }