mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
tset capi: code refactoring.
revise coding style.
This commit is contained in:
parent
fe493a93f2
commit
c19aa9fed7
4 changed files with 108 additions and 129 deletions
|
@ -25,6 +25,6 @@
|
|||
|
||||
TEST_CASE("Basic capi initialization", "[capiInitializer]")
|
||||
{
|
||||
REQUIRE(tvg_engine_init(TVG_ENGINE_SW | TVG_ENGINE_GL, 0) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_engine_term(TVG_ENGINE_SW | TVG_ENGINE_GL) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
|
|
@ -52,20 +52,19 @@ TEST_CASE("Paint Translate", "[capiPaintTranslate]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
Tvg_Matrix matrix_get;
|
||||
float tx = 20, ty = 30;
|
||||
Tvg_Matrix matrix;
|
||||
|
||||
REQUIRE(tvg_paint_translate(paint, tx, ty) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_transform(paint, &matrix_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(fabs(matrix_get.e11 - 1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e12 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e13 - tx) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e21 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e22 - 1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e23 - ty) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e31 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e32 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e33 - 1.0f) < UTC_EPSILON);
|
||||
REQUIRE(tvg_paint_translate(paint, 20, 30) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_transform(paint, &matrix) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(fabs(matrix.e11 - 1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e12 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e13 - 20) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e21 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e22 - 1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e23 - 30) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e31 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e32 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e33 - 1.0f) < UTC_EPSILON);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -75,20 +74,19 @@ TEST_CASE("Paint Scale", "[capiPaintScale]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
Tvg_Matrix matrix_get;
|
||||
float scale = 2.5f;
|
||||
Tvg_Matrix matrix;
|
||||
|
||||
REQUIRE(tvg_paint_scale(paint, scale) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_transform(paint, &matrix_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(fabs(matrix_get.e11 - scale) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e12 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e13 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e21 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e22 - scale) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e23 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e31 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e32 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e33 - 1.0f) < UTC_EPSILON);
|
||||
REQUIRE(tvg_paint_scale(paint, 2.5f) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_transform(paint, &matrix) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(fabs(matrix.e11 - 2.5f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e12 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e13 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e21 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e22 - 2.5f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e23 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e31 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e32 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e33 - 1.0f) < UTC_EPSILON);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -98,20 +96,19 @@ TEST_CASE("Paint Rotate", "[capiPaintRotate]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
Tvg_Matrix matrix_get;
|
||||
float degree = 180.0f;
|
||||
Tvg_Matrix matrix;
|
||||
|
||||
REQUIRE(tvg_paint_rotate(paint, degree) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_transform(paint, &matrix_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(fabs(matrix_get.e11 - -1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e12 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e13 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e21 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e22 - -1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e23 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e31 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e32 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix_get.e33 - 1.0f) < UTC_EPSILON);
|
||||
REQUIRE(tvg_paint_rotate(paint, 180.0f) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_transform(paint, &matrix) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(fabs(matrix.e11 - -1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e12 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e13 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e21 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e22 - -1.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e23 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e31 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e32 - 0.0f) < UTC_EPSILON);
|
||||
REQUIRE(fabs(matrix.e33 - 1.0f) < UTC_EPSILON);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -121,22 +118,19 @@ TEST_CASE("Paint Opacity", "[capiPaintOpacity]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
uint8_t opacity_set, opacity_get;
|
||||
uint8_t opacity;
|
||||
|
||||
opacity_set = 0;
|
||||
REQUIRE(tvg_paint_set_opacity(paint, opacity_set) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_opacity(paint, &opacity_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(opacity_get == opacity_get);
|
||||
REQUIRE(tvg_paint_set_opacity(paint, 0) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_opacity(paint, &opacity) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(0 == opacity);
|
||||
|
||||
opacity_set = 128;
|
||||
REQUIRE(tvg_paint_set_opacity(paint, opacity_set) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_opacity(paint, &opacity_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(opacity_get == opacity_get);
|
||||
REQUIRE(tvg_paint_set_opacity(paint, 128) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_opacity(paint, &opacity) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(128 == opacity);
|
||||
|
||||
opacity_set = 255;
|
||||
REQUIRE(tvg_paint_set_opacity(paint, opacity_set) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_opacity(paint, &opacity_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(opacity_get == opacity_get);
|
||||
REQUIRE(tvg_paint_set_opacity(paint, 255) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_opacity(paint, &opacity) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(255 == opacity);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -146,27 +140,26 @@ TEST_CASE("Paint Bounds", "[capiPaintBounds]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
float x = 0, y = 10, w = 20, h = 100;
|
||||
float x_get, y_get, w_get, h_get;
|
||||
float x, y, w, h;
|
||||
|
||||
REQUIRE(tvg_shape_append_rect(paint, x, y, w, h, 0, 0) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_bounds(paint, &x_get, &y_get, &w_get, &h_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_append_rect(paint, 0, 10, 20, 100, 0, 0) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_bounds(paint, &x, &y, &w, &h) == TVG_RESULT_SUCCESS);
|
||||
|
||||
REQUIRE(x == x_get);
|
||||
REQUIRE(y == y_get);
|
||||
REQUIRE(w == w_get);
|
||||
REQUIRE(h == h_get);
|
||||
REQUIRE(x == 0);
|
||||
REQUIRE(y == 10);
|
||||
REQUIRE(w == 20);
|
||||
REQUIRE(h == 100);
|
||||
|
||||
REQUIRE(tvg_shape_reset(paint) == TVG_RESULT_SUCCESS);
|
||||
|
||||
REQUIRE(tvg_shape_move_to(paint, x, y) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_line_to(paint, x + w, y + h) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_bounds(paint, &x_get, &y_get, &w_get, &h_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_move_to(paint, 0, 10) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_line_to(paint, 20, 110) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_paint_get_bounds(paint, &x, &y, &w, &h) == TVG_RESULT_SUCCESS);
|
||||
|
||||
REQUIRE(x == x_get);
|
||||
REQUIRE(y == y_get);
|
||||
REQUIRE(w == w_get);
|
||||
REQUIRE(h == h_get);
|
||||
REQUIRE(x == 0);
|
||||
REQUIRE(y == 10);
|
||||
REQUIRE(w == 20);
|
||||
REQUIRE(h == 100);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
|
@ -96,17 +96,15 @@ TEST_CASE("Stroke width", "[capiStrokeWidth]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
float stroke_set, stroke_get;
|
||||
float stroke;
|
||||
|
||||
stroke_set = 0.0f;
|
||||
REQUIRE(tvg_shape_set_stroke_width(paint, stroke_set) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_width(paint, &stroke_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(stroke_get == stroke_get);
|
||||
REQUIRE(tvg_shape_set_stroke_width(paint, 0.0f) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_width(paint, &stroke) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(stroke == 0.0f);
|
||||
|
||||
stroke_set = 5.0f;
|
||||
REQUIRE(tvg_shape_set_stroke_width(paint, stroke_set) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_width(paint, &stroke_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(stroke_get == stroke_get);
|
||||
REQUIRE(tvg_shape_set_stroke_width(paint, 5.0f) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_width(paint, &stroke) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(stroke == 5.0f);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -116,15 +114,14 @@ TEST_CASE("Stroke color", "[capiStrokeColor]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
uint8_t r = 255, g = 255, b = 255, a = 255;
|
||||
uint8_t r_get, g_get, b_get, a_get;
|
||||
uint8_t r, g, b, a;
|
||||
|
||||
REQUIRE(tvg_shape_set_stroke_color(paint, r, g, b, a) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_color(paint, &r_get, &g_get, &b_get, &a_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(r == r_get);
|
||||
REQUIRE(g == g_get);
|
||||
REQUIRE(b == b_get);
|
||||
REQUIRE(a == a_get);
|
||||
REQUIRE(tvg_shape_set_stroke_color(paint, 100, 200, 50, 1) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_color(paint, &r, &g, &b, &a) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(r == 100);
|
||||
REQUIRE(g == 200);
|
||||
REQUIRE(b == 50);
|
||||
REQUIRE(a == 1);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -134,15 +131,15 @@ TEST_CASE("Stroke dash", "[capiStrokeDash]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
float dashPattern[2] = {20, 10};
|
||||
float* dashPattern_get;
|
||||
float dash[2] = {20, 10};
|
||||
float* dash_get;
|
||||
uint32_t cnt;
|
||||
|
||||
REQUIRE(tvg_shape_set_stroke_dash(paint, dashPattern, 2) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_dash(paint, (const float**) &dashPattern_get, &cnt) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_set_stroke_dash(paint, dash, 2) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_dash(paint, (const float**) &dash_get, &cnt) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(cnt == 2);
|
||||
for (uint32_t i = 0; i < cnt; i++) {
|
||||
REQUIRE(dashPattern_get[i] == dashPattern[i]);
|
||||
REQUIRE(dash_get[i] == dash[i]);
|
||||
}
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
|
@ -153,17 +150,15 @@ TEST_CASE("Stroke cap", "[capiStrokeCap]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
Tvg_Stroke_Cap cap, cap_get;
|
||||
Tvg_Stroke_Cap cap;
|
||||
|
||||
cap = TVG_STROKE_CAP_ROUND;
|
||||
REQUIRE(tvg_shape_set_stroke_cap(paint, cap) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_cap(paint, &cap_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(cap == cap_get);
|
||||
REQUIRE(tvg_shape_set_stroke_cap(paint, TVG_STROKE_CAP_ROUND) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_cap(paint, &cap) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(cap == TVG_STROKE_CAP_ROUND);
|
||||
|
||||
cap = TVG_STROKE_CAP_BUTT;
|
||||
REQUIRE(tvg_shape_set_stroke_cap(paint, cap) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_cap(paint, &cap_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(cap == cap_get);
|
||||
REQUIRE(tvg_shape_set_stroke_cap(paint, TVG_STROKE_CAP_BUTT) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_cap(paint, &cap) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(cap == TVG_STROKE_CAP_BUTT);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -173,17 +168,15 @@ TEST_CASE("Stroke join", "[capiStrokeJoin]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
Tvg_Stroke_Join join, join_get;
|
||||
Tvg_Stroke_Join join;
|
||||
|
||||
join = TVG_STROKE_JOIN_BEVEL;
|
||||
REQUIRE(tvg_shape_set_stroke_join(paint, join) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_join(paint, &join_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(join == join_get);
|
||||
REQUIRE(tvg_shape_set_stroke_join(paint, TVG_STROKE_JOIN_BEVEL) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_join(paint, &join) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(join == TVG_STROKE_JOIN_BEVEL);
|
||||
|
||||
join = TVG_STROKE_JOIN_MITER;
|
||||
REQUIRE(tvg_shape_set_stroke_join(paint, join) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_join(paint, &join_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(join == join_get);
|
||||
REQUIRE(tvg_shape_set_stroke_join(paint, TVG_STROKE_JOIN_MITER) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_stroke_join(paint, &join) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(join == TVG_STROKE_JOIN_MITER);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -193,15 +186,14 @@ TEST_CASE("Fill color", "[capiFillColor]")
|
|||
Tvg_Paint* paint = tvg_shape_new();
|
||||
REQUIRE(paint);
|
||||
|
||||
uint8_t r = 255, g = 255, b = 255, a = 255;
|
||||
uint8_t r_get, g_get, b_get, a_get;
|
||||
uint8_t r, g, b, a;
|
||||
|
||||
REQUIRE(tvg_shape_set_fill_color(paint, r, g, b, a) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_fill_color(paint, &r_get, &g_get, &b_get, &a_get) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(r == r_get);
|
||||
REQUIRE(g == g_get);
|
||||
REQUIRE(b == b_get);
|
||||
REQUIRE(a == a_get);
|
||||
REQUIRE(tvg_shape_set_fill_color(paint, 129, 190, 57, 20) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_shape_get_fill_color(paint, &r, &g, &b, &a) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(r == 129);
|
||||
REQUIRE(g == 190);
|
||||
REQUIRE(b == 57);
|
||||
REQUIRE(a == 20);
|
||||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
@ -225,4 +217,3 @@ TEST_CASE("Fill rule", "[capiFillRule]")
|
|||
|
||||
REQUIRE(tvg_paint_del(paint) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,7 @@
|
|||
|
||||
TEST_CASE("Canvas initialization", "[capiCanvas]")
|
||||
{
|
||||
static uint32_t width = 200;
|
||||
static uint32_t height = 200;
|
||||
|
||||
uint32_t* buffer = (uint32_t*) malloc(sizeof(uint32_t) * width * height);
|
||||
uint32_t* buffer = (uint32_t*) malloc(sizeof(uint32_t) * 200 * 200);
|
||||
REQUIRE(buffer);
|
||||
|
||||
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
||||
|
@ -36,13 +33,11 @@ TEST_CASE("Canvas initialization", "[capiCanvas]")
|
|||
Tvg_Canvas* canvas = tvg_swcanvas_create();
|
||||
REQUIRE(canvas);
|
||||
|
||||
REQUIRE(tvg_swcanvas_set_target(canvas, buffer, width, width, height, TVG_COLORSPACE_ARGB8888) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_swcanvas_set_target(canvas, buffer, 200, 200, 200, TVG_COLORSPACE_ARGB8888) == TVG_RESULT_SUCCESS);
|
||||
|
||||
REQUIRE(tvg_canvas_draw(canvas) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_canvas_sync(canvas) == TVG_RESULT_SUCCESS);
|
||||
|
||||
REQUIRE(tvg_canvas_clear(canvas, true) == TVG_RESULT_SUCCESS);
|
||||
REQUIRE(tvg_canvas_destroy(canvas) == TVG_RESULT_SUCCESS);
|
||||
|
||||
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
//TODO: ++ more apis verification.
|
Loading…
Add table
Reference in a new issue