Files
remote-ui/tests/UI_button.cpp
T
sani7 149d27d980 Updates test includes for UI components
Updates test files to include necessary headers and removes the now unused `Test.hpp` file.
2026-02-14 14:32:21 +01:00

23 lines
625 B
C++

#include <gtest/gtest.h>
#include <QSignalSpy>
#include "ui_button.hpp"
TEST(UI_button, to_from_json)
{
UI_button button("button_text", Color(255, 255, 255), Color(0, 0, 0), nullptr);
json j = button.to_json(0);
UI_button button2;
button2.from_json(j);
EXPECT_EQ(button.text(), button2.text());
EXPECT_EQ(button.fg_color(), button2.fg_color());
EXPECT_EQ(button.bg_color(), button2.bg_color());
}
TEST(UI_button, signal)
{
UI_button button("button_text", Color::Default, Color::Default);
QSignalSpy spy(&button, &UI_button::clicked);
button.click();
EXPECT_EQ(spy.count(), 1);
}