summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2018-11-23 19:04:29 -0800
committerKenneth Graunke <kenneth@whitecape.org>2018-12-14 12:45:35 -0800
commitbf53cc10c7c4f9ce11b6ffb26115ecc4dc177161 (patch)
treecb381b500d3b74a2f4337ae20671614637597464
parent3dc40fabb8b0ef81e5847dec25006bc8d085743d (diff)
Probe pixel colors in bitmap-heart-dance test
This probes a single pixel at the center of each heart drawn, ensuring it's the correct color. Otherwise, failing to draw both halves would cause the test to pass.
-rw-r--r--tests/spec/gl-1.0/bitmap-heart-dance.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/spec/gl-1.0/bitmap-heart-dance.c b/tests/spec/gl-1.0/bitmap-heart-dance.c
index cb1c7faa7..768fee6e4 100644
--- a/tests/spec/gl-1.0/bitmap-heart-dance.c
+++ b/tests/spec/gl-1.0/bitmap-heart-dance.c
@@ -146,6 +146,18 @@ draw_row(const float* color, int length,
}
}
+static bool
+check_row(const float *color, int length, int x, int y, int spacex)
+{
+ bool pass = true;
+ for (int i = 0; i < length; i++) {
+ int probe_x = x + 8 + spacex + 4;
+ int probe_y = y + 4;
+ pass &= piglit_probe_pixel_rgb(probe_x, probe_y, color);
+ }
+ return pass;
+}
+
static GLuint fragShader, program;
enum piglit_result
@@ -203,8 +215,15 @@ piglit_display(void)
piglit_present_results();
- pass = piglit_probe_rects_equal(0, 0, 0, piglit_height/2,
- piglit_width, piglit_height/2, GL_RGB);
+ pass &= check_row( red, length, x, y + 5*spacing, spacing);
+ pass &= check_row( salmon, length, x, y + 4*spacing, spacing);
+ pass &= check_row( pink, length, x, y + 3*spacing, spacing);
+ pass &= check_row( orange, length, x, y + 2*spacing, spacing);
+ pass &= check_row(ltorange, length, x, y + 1*spacing, spacing);
+ pass &= check_row( yellow, length, x, y + 0*spacing, spacing);
+
+ pass &= piglit_probe_rects_equal(0, 0, 0, piglit_height/2,
+ piglit_width, piglit_height/2, GL_RGB);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}