Files
remote-ui/tests/UI_checkbox.cpp
T
sani7 2a76e13305 Removes JSON constructor from UI elements
This fixes the error: clang:optin.cplusplus.VirtualCall
When virtual methods are called during construction and destruction the polymorphism is restricted to the class that’s being constructed or destructed because the more derived contexts are either not yet initialized or already destructed.
2026-02-14 14:32:16 +01:00

14 lines
445 B
C++

#include "Test.hpp"
TEST(UI_checkbox, to_from_json)
{
UI_checkbox checkbox("checkbox_text", Color(255, 255, 255), Color(0, 0, 0));
json j = checkbox.to_json(0);
UI_checkbox checkbox2;
checkbox2.from_json(j);
EXPECT_EQ(checkbox.text(), checkbox2.text());
EXPECT_EQ(checkbox.fg_color(), checkbox2.fg_color());
EXPECT_EQ(checkbox.bg_color(), checkbox2.bg_color());
EXPECT_EQ(checkbox.state(), checkbox2.state());
}