test-cogl-materials: Test invalid layers with a constant color
authorNeil Roberts <neil@linux.intel.com>
Wed, 19 May 2010 22:42:40 +0000 (23:42 +0100)
committerNeil Roberts <neil@linux.intel.com>
Mon, 24 May 2010 15:10:56 +0000 (16:10 +0100)
This adds a test using a layer with no texture but that replaces the
fragment color with the layer constant. This currently causes the test
to fail.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132

tests/conform/test-cogl-materials.c

index b538568..ebc3474 100644 (file)
@@ -198,6 +198,32 @@ test_using_all_layers (TestState *state, int x, int y)
 }
 
 static void
+test_invalid_texture_layers_with_constant_colors (TestState *state,
+                                                  int x, int y)
+{
+  CoglHandle material = cogl_material_new ();
+  CoglColor constant_color;
+
+  /* explicitly create a layer with an invalid handle */
+  cogl_material_set_layer (material, 0, COGL_INVALID_HANDLE);
+
+  /* ignore the fallback texture on the layer and use a constant color
+     instead */
+  cogl_color_set_from_4ub (&constant_color, 0, 0, 255, 255);
+  cogl_material_set_layer_combine (material, 0,
+                                   "RGBA=REPLACE(CONSTANT)",
+                                   NULL);
+  cogl_material_set_layer_combine_constant (material, 0, &constant_color);
+
+  cogl_set_source (material);
+
+  cogl_handle_unref (material);
+
+  /* We expect the final fragments to be green */
+  test_material_with_primitives (state, x, y, 0x0000ffff);
+}
+
+static void
 on_paint (ClutterActor *actor, TestState *state)
 {
   int frame_num;
@@ -205,8 +231,11 @@ on_paint (ClutterActor *actor, TestState *state)
   test_invalid_texture_layers (state,
                                0, 0 /* position */
                                );
+  test_invalid_texture_layers_with_constant_colors (state,
+                                                    1, 0 /* position */
+                                                    );
   test_using_all_layers (state,
-                         1, 0 /* position */
+                         2, 0 /* position */
                          );
 
   /* XXX: Experiments have shown that for some buggy drivers, when using