#include <glib.h>
#include <gtest/gtest.h>
#include <vconf.h>
+#include <dlfcn.h>
#include "system_settings.h"
#include "mocks/sstt_mock.h"
+#define FONT_SCALE_CONF_PATH "conf_example/font_scale.json"
extern "C" {
#include "sst.h"
#include "sst_font.h"
#include "sst_vconf.h"
#include "sst_interface.h"
+
+typedef struct __font_size_info {
+ int small;
+ int normal;
+ int large;
+ int huge;
+ int giant;
+} font_size_info;
}
TEST(SstFontTest, getDefaultfontERR)
free(val);
}
+static void* _utils_load_lib()
+{
+ const char* const path = SETTING_UTILS_SO_FILE_PATH;
+ void *handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
+ if (NULL == handle)
+ ERR("dlopen(%s) Fail", path);
+
+ return handle;
+}
+
+TEST(SstFontTest,loadFontSizeInfo)
+{
+ font_size_info info;
+ void *handle = _utils_load_lib();
+ EXPECT_NE((void*)NULL, handle);
+
+ typedef int (*fn_impl)(font_size_info *info, const char *path);
+ fn_impl load_font_size_info = NULL;
+
+ load_font_size_info = (fn_impl)dlsym(handle, "load_font_size_info");
+ char *error = dlerror();
+ EXPECT_EQ(0, error);
+
+ int ret = load_font_size_info(&info, FONT_SCALE_CONF_PATH);
+ EXPECT_EQ(0, ret);
+
+ EXPECT_EQ(-80, info.small);
+ EXPECT_EQ(-150, info.large);
+ EXPECT_EQ(-100, info.normal);
+ EXPECT_EQ(-190, info.huge);
+ EXPECT_EQ(-250, info.giant);
+
+ dlclose(handle);
+ handle = NULL;
+}
+
TEST(SstFontTest, getDefaultfont)
{
char *val = NULL;