Files
remote-ui/tests/UI_hex_spinbox.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

25 lines
675 B
C++

#include <gtest/gtest.h>
#include <QSignalSpy>
#include "ui_hex_spinbox.hpp"
TEST(UI_hex_spinbox, to_from_json)
{
UI_hex_spinbox spinbox(0, 10, 5);
json j = spinbox.to_json(0);
UI_hex_spinbox spinbox2;
spinbox2.from_json(j);
EXPECT_EQ(spinbox.value(), spinbox2.value());
EXPECT_EQ(spinbox.min(), spinbox2.min());
EXPECT_EQ(spinbox.max(), spinbox2.max());
}
TEST(UI_hex_spinbox, signal)
{
UI_hex_spinbox spinbox(0, 10, 5);
QSignalSpy spy_ui(&spinbox, &UI_hex_spinbox::ui_changed);
QSignalSpy spy_val(&spinbox, &UI_hex_spinbox::changed);
spinbox.set_value(2);
EXPECT_EQ(spy_ui.count(), 1);
EXPECT_EQ(spy_val.count(), 1);
}