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
+20
View File
@@ -0,0 +1,20 @@
#include "Test.hpp"
TEST(UI_thermo, to_from_json)
{
UI_thermo thermo("thermo_id", "thermo_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50);
json j = thermo.to_json();
UI_thermo thermo2(j);
EXPECT_EQ(thermo.id(), thermo2.id());
EXPECT_EQ(thermo.text(), thermo2.text());
EXPECT_EQ(thermo.fg_color(), thermo2.fg_color());
EXPECT_EQ(thermo.bg_color(), thermo2.bg_color());
EXPECT_EQ(thermo.value(), thermo2.value());
}
TEST(UI_thermo, set_value)
{
UI_thermo thermo("thermo_id", "thermo_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50);
thermo.set_value(75);
EXPECT_EQ(thermo.value(), 75);
}