ilmClient: added test for ilm_displaySetRenderOrder
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 21 Jan 2013 12:17:03 +0000 (04:17 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Tue, 5 Feb 2013 13:20:04 +0000 (05:20 -0800)
Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp

index fb15d00..ea1217b 100644 (file)
@@ -20,7 +20,6 @@
 
 /* METHODS THAT ARE CURRENTLY NOT TESTED:
  *
- *     ilm_displaySetRenderOrder
  *     ilm_surfaceInvalidateRectangle
  *     ilm_layerSetChromaKey
  *     ilm_layerSetRenderOrder
@@ -759,3 +758,77 @@ TEST_F(IlmCommandTest, ilm_getPropertiesOfScreen) {
     ilm_getNumberOfHardwareLayers(screen, &numberOfHardwareLayers);
     ASSERT_EQ(numberOfHardwareLayers, screenProperties.harwareLayerCount);
 }
+
+TEST_F(IlmCommandTest, DisplaySetRenderOrder_growing) {
+    //prepare needed layers
+    t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
+    t_ilm_uint layerCount = sizeof(renderOrder) / sizeof(renderOrder[0]);
+
+    for (int i = 0; i < layerCount; ++i)
+    {
+        ilm_layerCreateWithDimension(renderOrder + i, 300, 300);
+        ilm_commitChanges();
+    }
+
+    t_ilm_display* screenIDs;
+    t_ilm_uint screenCount;
+    ilm_getScreenIDs(&screenCount, &screenIDs);
+
+    for(int i = 0; i < screenCount; ++i)
+    {
+        t_ilm_display screen = screenIDs[i];
+        ilmScreenProperties screenProps;
+
+        //trying different render orders with increasing sizes
+        for (int j = layerCount; j >= 0; --j)
+        {
+            //put them from end to beginning, so that in each loop iteration the order of layers change
+            ilm_displaySetRenderOrder(screen, renderOrder + j, layerCount - j);
+            ilm_commitChanges();
+            ilm_getPropertiesOfScreen(screen, &screenProps);
+
+            ASSERT_EQ(layerCount - j, screenProps.layerCount);
+            for(int k = 0; k < layerCount - j; ++k)
+            {
+                ASSERT_EQ(renderOrder[j + k], screenProps.layerIds[k]);
+            }
+        }
+    }
+}
+
+TEST_F(IlmCommandTest, DisplaySetRenderOrder_shrinking) {
+    //prepare needed layers
+    t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
+    t_ilm_uint layerCount = sizeof(renderOrder) / sizeof(renderOrder[0]);
+
+    for (int i = 0; i < layerCount; ++i)
+    {
+        ilm_layerCreateWithDimension(renderOrder + i, 300, 300);
+        ilm_commitChanges();
+    }
+
+    t_ilm_display* screenIDs;
+    t_ilm_uint screenCount;
+    ilm_getScreenIDs(&screenCount, &screenIDs);
+
+    for(int i = 0; i < screenCount; ++i)
+    {
+        t_ilm_display screen = screenIDs[i];
+        ilmScreenProperties screenProps;
+
+        //trying different render orders with decreasing sizes
+        for (int j = 0; j <= layerCount; ++j)
+        {
+            //put them from end to beginning, so that in each loop iteration the order of layers change
+            ilm_displaySetRenderOrder(screen, renderOrder + j, layerCount - j);
+            ilm_commitChanges();
+            ilm_getPropertiesOfScreen(screen, &screenProps);
+
+            ASSERT_EQ(layerCount - j, screenProps.layerCount);
+            for(int k = 0; k < layerCount - j; ++k)
+            {
+                ASSERT_EQ(renderOrder[j + k], screenProps.layerIds[k]);
+            }
+        }
+    }
+}