mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Extends UI element tests to include signal emission verification. This ensures that UI elements correctly emit signals upon user interaction, improving the reliability and responsiveness of the UI. Adds QSignalSpy to track signal emissions for various UI components like buttons, checkboxes, comboboxes, items, sliders, textboxes and thermos.
21 lines
573 B
C++
21 lines
573 B
C++
#include "Test.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);
|
|
}
|