Commit 3825d631 authored by Jeremy White's avatar Jeremy White
Browse files

Add a new test for tall screens; draw outside of scanline range.

This exposes a bug in the current code base.  That is, we
do not scan beyond the 32 scan lines currently given.

That means if we have a screen taller than 1024 pixels, we will
not scan every block fully, and so we can miss changes.

This test exposes that issue, and currently fails.
parent 9e3ba91a
......@@ -203,6 +203,7 @@ void test_tallscreen(xdummy_t *xdummy, gconstpointer user_data)
snprintf(buf, sizeof(buf), "xrandr --display :%s -s 3840x2160", xdummy->display);
/* Test basic drawing */
snprintf(buf, sizeof(buf), ":%s", xdummy->display);
if (xcbtest_draw_grid(buf)) {
g_warning("Could not draw the grid");
......@@ -213,6 +214,17 @@ void test_tallscreen(xdummy_t *xdummy, gconstpointer user_data)
check_screenshot(&test, &server, xdummy, buf);
/* Test drawing to the very bottom of the screen */
snprintf(buf, sizeof(buf), ":%s", xdummy->display);
if (xcbtest_draw_at_bottom(buf)) {
g_warning("Could not draw at the bottom");
else {
snprintf(buf, sizeof(buf), "%s/expected.grid.bottom.3840x2160.ppm", PATH_TO_TEST_SRC);
check_screenshot(&test, &server, xdummy, buf);
test_common_stop(&test, &server);
......@@ -124,3 +124,45 @@ int xcbtest_draw_grid(const char *display)
return 0;
int xcbtest_draw_at_bottom(const char *display)
uint32_t red_pixel;
xcb_connection_t *c;
xcb_screen_t *screen;
xcb_gcontext_t red_fg;
xcb_void_cookie_t cookie;
xcb_rectangle_t red_rectangle;
/* Open the connection to the X server */
c = xcb_connect(display, NULL);
if (xcb_connection_has_error(c))
return 1;
/* Get the first screen */
screen = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
red_fg = xcb_generate_id(c);
lookup_color(c, screen, "red", &red_pixel);
cookie = xcb_create_gc_checked(c, red_fg, screen->root, XCB_GC_FOREGROUND, &red_pixel);
xcb_request_check(c, cookie);
red_rectangle.width = screen->width_in_pixels;
red_rectangle.height = 8;
red_rectangle.x = 0;
red_rectangle.y = screen->height_in_pixels - red_rectangle.height * 2;
/* We draw the rectangles */
cookie = xcb_poly_fill_rectangle_checked(c, screen->root, red_fg, 1, &red_rectangle);
xcb_request_check(c, cookie);
/* We flush the request */
return 0;
......@@ -26,5 +26,6 @@
** Prototypes
int xcbtest_draw_grid(const char *display);
int xcbtest_draw_at_bottom(const char *display);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment