2019-05-13 17:19:11 +08:00
|
|
|
|
#include <string>
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
#include "widgets/button.h"
|
2019-08-19 18:43:23 +08:00
|
|
|
|
#include "base/window.h"
|
2019-05-13 17:19:11 +08:00
|
|
|
|
#include "layouters/children_layouter_default.h"
|
|
|
|
|
#include "base/children_layouter_factory.h"
|
|
|
|
|
|
|
|
|
|
TEST(ChildrenLayoutFactory, basic) {
|
|
|
|
|
children_layouter_t* l = NULL;
|
|
|
|
|
children_layouter_factory_t* f = children_layouter_factory_create();
|
|
|
|
|
|
|
|
|
|
children_layouter_factory_register(f, "test1", children_layouter_default_create);
|
|
|
|
|
children_layouter_factory_register(f, "test2", children_layouter_default_create);
|
|
|
|
|
children_layouter_factory_register(f, "test3", children_layouter_default_create);
|
|
|
|
|
|
|
|
|
|
l = children_layouter_factory_create_layouter(f, "test1");
|
|
|
|
|
ASSERT_EQ(l != NULL, TRUE);
|
|
|
|
|
children_layouter_destroy(l);
|
|
|
|
|
|
|
|
|
|
l = children_layouter_factory_create_layouter(f, "test2");
|
|
|
|
|
ASSERT_EQ(l != NULL, TRUE);
|
|
|
|
|
children_layouter_destroy(l);
|
|
|
|
|
|
|
|
|
|
l = children_layouter_factory_create_layouter(f, "test3");
|
|
|
|
|
ASSERT_EQ(l != NULL, TRUE);
|
|
|
|
|
children_layouter_destroy(l);
|
2019-05-13 17:53:02 +08:00
|
|
|
|
|
2019-05-13 17:19:11 +08:00
|
|
|
|
l = children_layouter_factory_create_layouter(f, "notexist");
|
|
|
|
|
ASSERT_EQ(l == NULL, TRUE);
|
|
|
|
|
|
|
|
|
|
children_layouter_factory_destroy(f);
|
|
|
|
|
}
|