mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 12:08:16 +08:00
add test
This commit is contained in:
parent
85ad3474e1
commit
d7d0953252
19
tests/gif_image_test.cc
Normal file
19
tests/gif_image_test.cc
Normal file
@ -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
tests/svg_image_test.cc
Normal file
19
tests/svg_image_test.cc
Normal file
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user