mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +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.
22 lines
658 B
C++
22 lines
658 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());
|
|
}
|
|
|
|
TEST(UI_checkbox, signal)
|
|
{
|
|
UI_checkbox checkbox("checkbox_text", Color::Default, Color::Default);
|
|
QSignalSpy spy(&checkbox, &UI_checkbox::changed);
|
|
checkbox.click();
|
|
EXPECT_EQ(spy.count(), 1);
|
|
}
|