Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Jan 17, 2019
1 parent 85ad347 commit d7d0953
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/gif_image_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "widgets/window.h"
#include "gif_image/gif_image.h"
#include "gtest/gtest.h"

TEST(GifImage, basic) {
value_t v;
value_t v1;
widget_t* w = window_create(NULL, 0, 0, 0, 0);
widget_t* img = gif_image_create(w, 0, 0, 100, 100);

value_set_str(&v, "earth");
ASSERT_EQ(widget_set_prop(img, WIDGET_PROP_IMAGE, &v), RET_OK);
ASSERT_EQ(widget_get_prop(img, WIDGET_PROP_IMAGE, &v1), RET_OK);
ASSERT_EQ(strcmp(value_str(&v), value_str(&v1)), 0);
ASSERT_EQ(widget_count_children(w), 1);

widget_destroy(w);
}

19 changes: 19 additions & 0 deletions tests/svg_image_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "widgets/window.h"
#include "svg_image/svg_image.h"
#include "gtest/gtest.h"

TEST(SvgImage, basic) {
value_t v;
value_t v1;
widget_t* w = window_create(NULL, 0, 0, 0, 0);
widget_t* img = svg_image_create(w, 0, 0, 100, 100);

value_set_str(&v, "earth");
ASSERT_EQ(widget_set_prop(img, WIDGET_PROP_IMAGE, &v), RET_OK);
ASSERT_EQ(widget_get_prop(img, WIDGET_PROP_IMAGE, &v1), RET_OK);
ASSERT_EQ(strcmp(value_str(&v), value_str(&v1)), 0);
ASSERT_EQ(widget_count_children(w), 1);

widget_destroy(w);
}

0 comments on commit d7d0953

Please sign in to comment.