mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Updates test files to include necessary headers and removes the now unused `Test.hpp` file.
25 lines
741 B
C++
25 lines
741 B
C++
#include <gtest/gtest.h>
|
|
#include <QSignalSpy>
|
|
#include "ui_thermo.hpp"
|
|
|
|
TEST(UI_thermo, to_from_json)
|
|
{
|
|
UI_thermo thermo("thermo_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50);
|
|
json j = thermo.to_json(0);
|
|
UI_thermo thermo2;
|
|
thermo2.from_json(j);
|
|
EXPECT_EQ(thermo.text(), thermo2.text());
|
|
EXPECT_EQ(thermo.fg_color(), thermo2.fg_color());
|
|
EXPECT_EQ(thermo.bg_color(), thermo2.bg_color());
|
|
EXPECT_EQ(thermo.value(), thermo2.value());
|
|
}
|
|
|
|
TEST(UI_thermo, set_value)
|
|
{
|
|
UI_thermo thermo("thermo_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50);
|
|
QSignalSpy spy(&thermo, &UI_thermo::ui_changed);
|
|
thermo.set_value(75);
|
|
EXPECT_EQ(thermo.value(), 75);
|
|
EXPECT_EQ(spy.count(), 1);
|
|
}
|