+#ifdef TEST_PATTERN
+ {
+/* XWindowAttributes xgwa;
+ XGetWindowAttributes(c->dpy, c->win, &xgwa); */
+
+ // if(xgwa.width >= 9 && xgwa.height >= 10)
+ {
+ Screen *screen = ScreenOfDisplay(c->dpy, DefaultScreen(c->dpy));
+ Visual *visual = DefaultVisualOfScreen(screen);
+ Pixmap pixmap = XCreatePixmap(c->dpy, TARGET(c), 3, 10, visual_depth(screen, visual));
+
+ {
+ XSetForeground(c->dpy, c->copy_gc, _alloc_color(c, 0xffff, 0x7fff, 0x7fff));
+ XDrawPoint(c->dpy, TARGET(c), c->copy_gc, 0, c->h - 1);
+ }
+
+ uint32_t rgb[3], cells;
+ rgb[0] = _alloc_color(c, 0xffff, 0, 0);
+ rgb[1] = _alloc_color(c, 0, 0xffff, 0);
+ rgb[2] = _alloc_color(c, 0, 0, 0xffff);
+ cells = rgb[0] | rgb[1] | rgb[2];
+
+ _test_pattern(c->dpy, TARGET(c), c->copy_gc, rgb);
+ _test_pattern(c->dpy, pixmap, c->copy_gc, rgb);
+ // Here's a good spot to verify that the pixmap contains the right colors at the top.
+ _copy_test(c->dpy, TARGET(c), pixmap, c->copy_gc, 0, 6, cells);
+
+ XCopyArea(c->dpy, pixmap, TARGET(c), c->copy_gc, 0, 0, 3, 10, 3, 0);
+ {
+ XImage *image = XGetImage(c->dpy, pixmap, 0, 0, 3, 10, cells, ZPixmap);
+ XPutImage(c->dpy, TARGET(c), c->copy_gc, image, 0, 0, 6, 0, 3, 10);
+ XDestroyImage(image);
+ }
+
+ XFreePixmap(c->dpy, pixmap);
+ XSync(c->dpy, False);
+ }
+ }
+#endif /* TEST_PATTERN */
+