mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
Adds unit tests for UI components. UI_can, UI_stacked_widget, UI_status_bar and UI_tab_widget
23 lines
637 B
C++
23 lines
637 B
C++
#include "Test.hpp"
|
|
|
|
TEST(UI_status_bar, to_from_json)
|
|
{
|
|
UI_status_bar statusbar("message");
|
|
json j = statusbar.to_json(0);
|
|
UI_status_bar statusbar2;
|
|
statusbar2.from_json(j);
|
|
EXPECT_EQ(statusbar.text(), statusbar2.text());
|
|
}
|
|
|
|
TEST(UI_status_bar, show_message)
|
|
{
|
|
UI_status_bar statusbar("message");
|
|
QSignalSpy spy_ui(&statusbar, &UI_status_bar::ui_changed);
|
|
EXPECT_EQ(statusbar.text(), "message");
|
|
EXPECT_EQ(statusbar.timeout(), 0);
|
|
statusbar.show_message("random text", 3);
|
|
EXPECT_EQ(statusbar.text(), "random text");
|
|
EXPECT_EQ(statusbar.timeout(), 3);
|
|
EXPECT_EQ(spy_ui.count(), 1);
|
|
}
|