aboutsummaryrefslogtreecommitdiff
path: root/test/core.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-03 23:42:12 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-03 23:42:12 +0100
commit463ecfe1c5056bac32d852ad0dde96345aa58d75 (patch)
tree461063482574bdf470c60c0643cfba41e777dc59 /test/core.c
parent4bf264f2eb5b1c2ad6da0f29cba2258afbc46dc4 (diff)
downloadd2tk-463ecfe1c5056bac32d852ad0dde96345aa58d75.tar.xz
test: always set dimensions.
Diffstat (limited to 'test/core.c')
-rw-r--r--test/core.c64
1 files changed, 60 insertions, 4 deletions
diff --git a/test/core.c b/test/core.c
index 6425f13..a25c44c 100644
--- a/test/core.c
+++ b/test/core.c
@@ -60,6 +60,8 @@ _d2tk_mock_post(void *data, d2tk_core_t *core, d2tk_coord_t w, d2tk_coord_t h,
ctx->post.h = h;
ctx->post.pass = pass;
+ assert(d2tk_core_get_pixels(core));
+
return false; // do NOT enter 3rd pass
}
@@ -93,7 +95,7 @@ _d2tk_mock_process(void *data, d2tk_core_t *core, const d2tk_com_t *com,
assert(com->instr == D2TK_INSTR_BBOX);
const d2tk_body_bbox_t *body = &com->body->bbox;
- assert(body->dirty == true);
+ assert(body->dirty == false);
assert(body->cached == true);
assert(body->hash != 0x0); //FIXME
@@ -205,9 +207,6 @@ _test_dimensions()
d2tk_core_free(core);
}
-#undef DIM_W
-#undef DIM_H
-
#define BG_COLOR 0x222222ff
static void
@@ -216,6 +215,8 @@ _test_bg_color()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, NULL);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_set_bg_color(core, BG_COLOR);
assert(BG_COLOR == d2tk_core_get_bg_color(core));
@@ -258,6 +259,8 @@ _test_move_to()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -267,6 +270,14 @@ _test_move_to()
d2tk_core_bbox_pop(core, ref);
d2tk_core_post(core);
+
+ // trigger garbage collector
+ for(unsigned i = 0; i < 0x400; i++)
+ {
+ d2tk_core_pre(core);
+ d2tk_core_post(core);
+ }
+
d2tk_core_free(core);
}
@@ -302,6 +313,8 @@ _test_line_to()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -350,6 +363,8 @@ _test_rect()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -402,6 +417,8 @@ _test_rounded_rect()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -457,6 +474,8 @@ _test_arc()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -512,6 +531,8 @@ _test_curve_to()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -559,6 +580,8 @@ _test_color()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -610,6 +633,8 @@ _test_linear_gradient()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -661,6 +686,8 @@ _test_stroke()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -697,6 +724,8 @@ _test_fill()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -733,6 +762,8 @@ _test_save()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -769,6 +800,8 @@ _test_restore()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -808,6 +841,8 @@ _test_rotate()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -846,6 +881,8 @@ _test_begin_path()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -882,6 +919,8 @@ _test_close_path()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -927,6 +966,8 @@ _test_scissor()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -968,6 +1009,8 @@ _test_reset_scissor()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -1007,6 +1050,8 @@ _test_font_size()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -1048,6 +1093,8 @@ _test_font_face()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -1099,6 +1146,8 @@ _test_text()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -1156,6 +1205,8 @@ _test_image()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -1203,6 +1254,8 @@ _test_stroke_width()
d2tk_core_t *core = d2tk_core_new(&d2tk_mock_driver, &ctx);
assert(core);
+ d2tk_core_set_dimensions(core, DIM_W, DIM_H);
+
d2tk_core_pre(core);
const ssize_t ref = d2tk_core_bbox_push(core, true,
&D2TK_RECT(CLIP_X, CLIP_Y, CLIP_W, CLIP_H));
@@ -1222,6 +1275,9 @@ _test_stroke_width()
#undef CLIP_W
#undef CLIP_H
+#undef DIM_W
+#undef DIM_H
+
int
main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
{