2019-05-13 17:19:11 +08:00
|
|
|
|
#include <string>
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
#include "widgets/button.h"
|
|
|
|
|
#include "widgets/window.h"
|
|
|
|
|
#include "layouters/self_layouter_default.h"
|
|
|
|
|
#include "base/self_layouter_factory.h"
|
|
|
|
|
|
|
|
|
|
TEST(SelfLayoutFactory, basic) {
|
|
|
|
|
self_layouter_t* l = NULL;
|
|
|
|
|
self_layouter_factory_t* f = self_layouter_factory_create();
|
|
|
|
|
|
|
|
|
|
self_layouter_factory_register(f, "test1", self_layouter_default_create);
|
|
|
|
|
self_layouter_factory_register(f, "test2", self_layouter_default_create);
|
|
|
|
|
self_layouter_factory_register(f, "test3", self_layouter_default_create);
|
|
|
|
|
|
|
|
|
|
l = self_layouter_factory_create_layouter(f, "test1");
|
|
|
|
|
ASSERT_EQ(l != NULL, TRUE);
|
|
|
|
|
self_layouter_destroy(l);
|
|
|
|
|
|
|
|
|
|
l = self_layouter_factory_create_layouter(f, "test2");
|
|
|
|
|
ASSERT_EQ(l != NULL, TRUE);
|
|
|
|
|
self_layouter_destroy(l);
|
|
|
|
|
|
|
|
|
|
l = self_layouter_factory_create_layouter(f, "test3");
|
|
|
|
|
ASSERT_EQ(l != NULL, TRUE);
|
|
|
|
|
self_layouter_destroy(l);
|
2019-05-13 17:53:02 +08:00
|
|
|
|
|
2019-05-13 17:19:11 +08:00
|
|
|
|
l = self_layouter_factory_create_layouter(f, "notexist");
|
|
|
|
|
ASSERT_EQ(l == NULL, TRUE);
|
|
|
|
|
|
|
|
|
|
self_layouter_factory_destroy(f);
|
|
|
|
|
}
|