+static int test_ewmh_icon_prepare(void)
+{
+ int ret = EXIT_SUCCESS;
+ unsigned i;
+
+ XColor *template = (void *)colours;
+ XColor newmap[sizeof colours / sizeof colours[0][0]];
+
+ printf("1..%d\n", (int)XTRA_ARRAYSIZE(newmap));
+ for (i = 0; i < XTRA_ARRAYSIZE(newmap); i++) {
+ newmap[i] = template[i];
+ newmap[i].pixel = 0;
+ }
+
+ ewmh_icon_prepare_cmap(newmap, XTRA_ARRAYSIZE(newmap));
+ for (i = 0; i < XTRA_ARRAYSIZE(newmap); i++) {
+ XColor *c = &newmap[i];
+
+ if (c->pixel != template[i].pixel) {
+ printf("not ");
+ ret = EXIT_FAILURE;
+ }
+
+ printf("ok %u (%.4hx, %.4hx, %.4hx) -> %.8lx\n",
+ i+1, c->red, c->green, c->blue, c->pixel);
+ }
+
+ return ret;
+}
+