mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
ui_items
Remove Text_size Add setup_item to configure if an item uses text, fg color and bg color.
This commit is contained in:
+2
-11
@@ -14,13 +14,6 @@ TEST(UI_item, set_text)
|
||||
EXPECT_EQ(item.text(), "text");
|
||||
}
|
||||
|
||||
TEST(UI_item, text_size)
|
||||
{
|
||||
UI_item item(std::string("item"));
|
||||
item.set_text_size(12);
|
||||
EXPECT_EQ(item.text_size(), 12);
|
||||
}
|
||||
|
||||
TEST(UI_item, set_fg_color)
|
||||
{
|
||||
UI_item item(std::string("item"));
|
||||
@@ -56,19 +49,17 @@ TEST(UI_item, from_json)
|
||||
|
||||
item.from_json(j);
|
||||
EXPECT_EQ(item.text(), "item_text");
|
||||
EXPECT_EQ(item.text_size(), 12);
|
||||
EXPECT_EQ(item.fg_color(), Color(255, 255, 255));
|
||||
EXPECT_EQ(item.bg_color(), Color(0, 0, 0));
|
||||
}
|
||||
|
||||
TEST(UI_item, to_json)
|
||||
{
|
||||
UI_item item("item", "item_text", 12, Color(255, 255, 255), Color(0, 0, 0));
|
||||
UI_item item("item", "item_text", Color(255, 255, 255), Color(0, 0, 0));
|
||||
json j = item.to_json(0);
|
||||
EXPECT_EQ(j.at("type"), "item");
|
||||
EXPECT_EQ(j.at("id"), 0);
|
||||
EXPECT_EQ(j.at("text"), "item_text");
|
||||
EXPECT_EQ(j.at("text_size"), 12);
|
||||
EXPECT_EQ(j.at("fg_color"), Color(255, 255, 255).to_hex());
|
||||
EXPECT_EQ(j.at("bg_color"), Color(0, 0, 0).to_hex());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -7,13 +7,11 @@ TEST(UI_label, to_from_json)
|
||||
EXPECT_EQ(j["type"], "ui_label");
|
||||
EXPECT_EQ(j["id"], 0);
|
||||
EXPECT_EQ(j["text"], "label_text");
|
||||
EXPECT_EQ(j["text_size"], 12);
|
||||
EXPECT_EQ(j["fg_color"], "#000000FF");
|
||||
EXPECT_EQ(j["bg_color"], "#FFFFFFFF");
|
||||
|
||||
UI_label label2(j);
|
||||
EXPECT_EQ(label2.text(), "label_text");
|
||||
EXPECT_EQ(label2.text_size(), 12);
|
||||
EXPECT_EQ(label2.fg_color(), Color(0, 0, 0));
|
||||
EXPECT_EQ(label2.bg_color(), Color(255, 255, 255));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user