rendercheck: rendercheck.h t_dstcoords.c tests.c
Eric Anholt
anholt at kemper.freedesktop.org
Sat Feb 3 01:59:45 EET 2007
rendercheck.h | 2 +-
t_dstcoords.c | 19 +++++++++++--------
tests.c | 9 ++++++---
3 files changed, 18 insertions(+), 12 deletions(-)
New commits:
diff-tree 160d69f593f4054d1973b27a24bf24323774c346 (from 2ae83b5c2783dbce9523ce030a50596eb6804c2b)
Author: Eric Anholt <eric at anholt.net>
Date: Fri Feb 2 15:55:07 2007 -0800
Unbreak the dstcoords test, and test it with PictOpOver, as well.
Testing on dests[0] meant an a8 picture, which doesn't capture color very well.
Use the window, instead. Also, make the code match the comment about it being
a 3x3 picture (previously, we drew 1x1).
diff --git a/rendercheck.h b/rendercheck.h
index f32420e..ada9a8e 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -136,7 +136,7 @@ composite_test(Display *dpy, picture_inf
Bool componentAlpha, Bool print_errors);
Bool
-dstcoords_test(Display *dpy, picture_info *win, picture_info *dst,
+dstcoords_test(Display *dpy, picture_info *win, int op, picture_info *dst,
picture_info *bg, picture_info *fg);
Bool
diff --git a/t_dstcoords.c b/t_dstcoords.c
index e9f14d9..f6adab7 100644
--- a/t_dstcoords.c
+++ b/t_dstcoords.c
@@ -28,11 +28,13 @@
#define TEST_HEIGHT 10
/* Test destination coordinates by drawing a 3x3 picture offset one pixel.
- * XXX: This should be done with another operation, to catch issues with Render
- * acceleration in the non-CopyArea-equivalent case.
+ *
+ * Note: fg must have solid 1.0 alpha, but still have an alpha channel.
+ * Otherwise, we're likely to hit a path that maps PictOpOver -> PictOpSrc,
+ * for example.
*/
Bool
-dstcoords_test(Display *dpy, picture_info *win, picture_info *dst,
+dstcoords_test(Display *dpy, picture_info *win, int op, picture_info *dst,
picture_info *bg, picture_info *fg)
{
color4d expected, tested;
@@ -42,19 +44,20 @@ dstcoords_test(Display *dpy, picture_inf
for (i = 0; i < pixmap_move_iter; i++) {
XRenderComposite(dpy, PictOpSrc, bg->pict, 0, dst->pict, 0, 0,
0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
- XRenderComposite(dpy, PictOpSrc, fg->pict, 0, dst->pict, 0, 0,
- 0, 0, 1, 1, 1, 1);
+ XRenderComposite(dpy, op, fg->pict, 0, dst->pict, 0, 0,
+ 0, 0, 1, 1, 3, 3);
}
copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT);
- for (x = 0; x < 3; x++) {
- for (y = 0; y < 3; y++) {
+ for (x = 0; x < 5; x++) {
+ for (y = 0; y < 5; y++) {
get_pixel(dpy, dst, x, y, &tested);
- if (x == 1 && y == 1)
+ if ((x >= 1 && x <= 3) && (y >= 1 && y <= 3))
expected = fg->color;
else
expected = bg->color;
+
color_correct(dst, &expected);
if (!eval_diff("dst coords", &expected, &tested, x, y,
is_verbose))
diff --git a/tests.c b/tests.c
index ced755a..5f8fead 100644
--- a/tests.c
+++ b/tests.c
@@ -436,9 +436,12 @@ do { \
Bool ok, group_ok = TRUE;
printf("Beginning dest coords test\n");
- ok = dstcoords_test(dpy, win, &dests[0], argb32white,
- argb32red);
- RECORD_RESULTS();
+ for (i = 0; i < 2; i++) {
+ ok = dstcoords_test(dpy, win,
+ i == 0 ? PictOpSrc : PictOpOver, win,
+ argb32white, argb32red);
+ RECORD_RESULTS();
+ }
if (group_ok)
success_mask |= TEST_DSTCOORDS;
}
More information about the xorg-commit
mailing list