Add extra ui tests
This commit is contained in:
2024-08-27 15:19:57 +02:00
parent ebc2a28241
commit d47510f58f
7 changed files with 108 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#include "Test.hpp"
TEST(UI_textbox, to_from_json)
{
UI_textbox textbox(std::string("textbox"), std::string("hint"), Color(0, 0, 0), Color(255, 255, 255));
json j = textbox.to_json();
UI_textbox textbox2(j);
EXPECT_EQ(textbox.id(), textbox2.id());
EXPECT_EQ(textbox.text(), textbox2.text());
EXPECT_EQ(textbox.fg_color(), textbox2.fg_color());
EXPECT_EQ(textbox.bg_color(), textbox2.bg_color());
EXPECT_EQ(textbox.text(), textbox2.text());
}
TEST(UI_textbox, set_text)
{
UI_textbox textbox(std::string("textbox"), std::string("hint"), Color(0, 0, 0), Color(255, 255, 255));
EXPECT_EQ(textbox.text(), "");
textbox.set_text("random text");
EXPECT_EQ(textbox.text(), "random text");
}