diff --git a/tests/UI_button.cpp b/tests/UI_button.cpp index 45dd74a..26fcf73 100644 --- a/tests/UI_button.cpp +++ b/tests/UI_button.cpp @@ -3,10 +3,9 @@ TEST(UI_button, to_from_json) { - UI_button button("button_id", "button_text", Color(255, 255, 255), Color(0, 0, 0), nullptr); - json j = button.to_json(); + UI_button button("button_text", Color(255, 255, 255), Color(0, 0, 0), nullptr); + json j = button.to_json(0); UI_button button2(j); - EXPECT_EQ(button.id(), button2.id()); EXPECT_EQ(button.text(), button2.text()); EXPECT_EQ(button.fg_color(), button2.fg_color()); EXPECT_EQ(button.bg_color(), button2.bg_color()); diff --git a/tests/UI_checkbox.cpp b/tests/UI_checkbox.cpp index 4ae8f9f..f5257f1 100644 --- a/tests/UI_checkbox.cpp +++ b/tests/UI_checkbox.cpp @@ -2,10 +2,9 @@ TEST(UI_checkbox, to_from_json) { - UI_checkbox checkbox("checkbox_id", "checkbox_text", Color(255, 255, 255), Color(0, 0, 0), {"option1", "option2"}); - json j = checkbox.to_json(); + UI_checkbox checkbox("checkbox_text", Color(255, 255, 255), Color(0, 0, 0)); + json j = checkbox.to_json(0); UI_checkbox checkbox2(j); - EXPECT_EQ(checkbox.id(), checkbox2.id()); EXPECT_EQ(checkbox.text(), checkbox2.text()); EXPECT_EQ(checkbox.fg_color(), checkbox2.fg_color()); EXPECT_EQ(checkbox.bg_color(), checkbox2.bg_color()); diff --git a/tests/UI_combobox.cpp b/tests/UI_combobox.cpp index 157ae9f..dacbc1c 100644 --- a/tests/UI_combobox.cpp +++ b/tests/UI_combobox.cpp @@ -2,10 +2,9 @@ TEST(UI_combobox, to_from_json) { - UI_combobox checkbox("checkbox_id", "checkbox_text", Color(255, 255, 255), Color(0, 0, 0), {"option1", "option2"}); - json j = checkbox.to_json(); + UI_combobox checkbox("checkbox_text", Color(255, 255, 255), Color(0, 0, 0), {"option1", "option2"}); + json j = checkbox.to_json(0); UI_combobox checkbox2(j); - EXPECT_EQ(checkbox.id(), checkbox2.id()); EXPECT_EQ(checkbox.text(), checkbox2.text()); EXPECT_EQ(checkbox.fg_color(), checkbox2.fg_color()); EXPECT_EQ(checkbox.bg_color(), checkbox2.bg_color()); diff --git a/tests/UI_dial.cpp b/tests/UI_dial.cpp index bc21f96..760a647 100644 --- a/tests/UI_dial.cpp +++ b/tests/UI_dial.cpp @@ -2,10 +2,9 @@ TEST(UI_dial, to_from_json) { - UI_dial dial("slider_id", "slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); - json j = dial.to_json(); + UI_dial dial("slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); + json j = dial.to_json(0); UI_dial dial2(j); - EXPECT_EQ(dial.id(), dial2.id()); EXPECT_EQ(dial.text(), dial2.text()); EXPECT_EQ(dial.fg_color(), dial2.fg_color()); EXPECT_EQ(dial.bg_color(), dial2.bg_color()); @@ -14,7 +13,7 @@ TEST(UI_dial, to_from_json) TEST(UI_dial, set_value) { - UI_dial dial("slider_id", "slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); + UI_dial dial("slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); dial.set_value(75); EXPECT_EQ(dial.value(), 75); } diff --git a/tests/UI_item.cpp b/tests/UI_item.cpp index ec947a4..7ffd0f1 100644 --- a/tests/UI_item.cpp +++ b/tests/UI_item.cpp @@ -45,8 +45,8 @@ TEST(UI_item, from_json) { UI_item item(std::string("item")); json j; + j["id"] = 0; j["type"] = "item"; - j["id"] = "item_id"; j["text"] = "item_text"; j["text_size"] = 12; j["fg_color"] = "0xFFFFFFFF"; @@ -55,7 +55,6 @@ TEST(UI_item, from_json) j["visible"] = true; item.from_json(j); - EXPECT_EQ(item.id(), "item_id"); EXPECT_EQ(item.text(), "item_text"); EXPECT_EQ(item.text_size(), 12); EXPECT_EQ(item.fg_color(), Color(255, 255, 255)); @@ -64,10 +63,10 @@ TEST(UI_item, from_json) TEST(UI_item, to_json) { - UI_item item("item_id", "item", "item_text", 12, Color(255, 255, 255), Color(0, 0, 0)); - json j = item.to_json(); + UI_item item("item", "item_text", 12, Color(255, 255, 255), Color(0, 0, 0)); + json j = item.to_json(0); EXPECT_EQ(j.at("type"), "item"); - EXPECT_EQ(j.at("id"), "item_id"); + EXPECT_EQ(j.at("id"), 0); EXPECT_EQ(j.at("text"), "item_text"); EXPECT_EQ(j.at("text_size"), 12); EXPECT_EQ(j.at("fg_color"), Color(255, 255, 255).to_hex()); diff --git a/tests/UI_label.cpp b/tests/UI_label.cpp index df4074a..efbb905 100644 --- a/tests/UI_label.cpp +++ b/tests/UI_label.cpp @@ -2,17 +2,16 @@ TEST(UI_label, to_from_json) { - UI_label label(std::string("label"), std::string("label_text"), Color(0, 0, 0), Color(255, 255, 255)); - json j = label.to_json(); + UI_label label("label_text", Color(0, 0, 0), Color(255, 255, 255)); + json j = label.to_json(0); EXPECT_EQ(j["type"], "UI_label"); - EXPECT_EQ(j["id"], "label"); + EXPECT_EQ(j["id"], 0); EXPECT_EQ(j["text"], "label_text"); EXPECT_EQ(j["text_size"], 12); EXPECT_EQ(j["fg_color"], "#000000FF"); EXPECT_EQ(j["bg_color"], "#FFFFFFFF"); UI_label label2(j); - EXPECT_EQ(label2.id(), "label"); EXPECT_EQ(label2.text(), "label_text"); EXPECT_EQ(label2.text_size(), 12); EXPECT_EQ(label2.fg_color(), Color(0, 0, 0)); diff --git a/tests/UI_led.cpp b/tests/UI_led.cpp index 3fabab0..614b1df 100644 --- a/tests/UI_led.cpp +++ b/tests/UI_led.cpp @@ -2,10 +2,9 @@ TEST(UI_led, to_from_json) { - UI_led led(std::string("led"), std::string("led_text"), Color(0, 0, 0), Color(255, 255, 255), Color(255, 0, 0)); - json j = led.to_json(); + UI_led led("led_text", Color(0, 0, 0), Color(255, 255, 255), Color(255, 0, 0)); + json j = led.to_json(0); UI_led led2(j); - EXPECT_EQ(led.id(), led2.id()); EXPECT_EQ(led.text(), led2.text()); EXPECT_EQ(led.fg_color(), led2.fg_color()); EXPECT_EQ(led.bg_color(), led2.bg_color()); @@ -14,7 +13,7 @@ TEST(UI_led, to_from_json) TEST(UI_led, set_led_color) { - UI_led led(std::string("led"), std::string("led_text"), Color(0, 0, 0), Color(255, 255, 255), Color(255, 0, 0)); + UI_led led("led_text", Color(0, 0, 0), Color(255, 255, 255), Color(255, 0, 0)); led.set_led_color(Color(0, 255, 0)); EXPECT_EQ(led.led_color(), Color(0, 255, 0)); } \ No newline at end of file diff --git a/tests/UI_slider.cpp b/tests/UI_slider.cpp index a7ebda0..9ee2410 100644 --- a/tests/UI_slider.cpp +++ b/tests/UI_slider.cpp @@ -2,10 +2,9 @@ TEST(UI_slider, to_from_json) { - UI_slider slider("slider_id", "slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50, nullptr); - json j = slider.to_json(); + UI_slider slider("slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50, nullptr); + json j = slider.to_json(0); UI_slider slider2(j); - EXPECT_EQ(slider.id(), slider2.id()); EXPECT_EQ(slider.text(), slider2.text()); EXPECT_EQ(slider.fg_color(), slider2.fg_color()); EXPECT_EQ(slider.bg_color(), slider2.bg_color()); @@ -14,6 +13,6 @@ TEST(UI_slider, to_from_json) TEST(UI_slider, value) { - UI_slider slider("slider_id", "slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); + UI_slider slider("slider_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); EXPECT_EQ(slider.value(), 50); } diff --git a/tests/UI_textbox.cpp b/tests/UI_textbox.cpp index 955011a..96b54d3 100644 --- a/tests/UI_textbox.cpp +++ b/tests/UI_textbox.cpp @@ -2,10 +2,9 @@ TEST(UI_textbox, to_from_json) { - UI_textbox textbox(std::string("textbox"), std::string("hint"), Color(0, 0, 0), Color(255, 255, 255)); - json j = textbox.to_json(); + UI_textbox textbox("hint", Color(0, 0, 0), Color(255, 255, 255)); + json j = textbox.to_json(0); UI_textbox textbox2(j); - EXPECT_EQ(textbox.id(), textbox2.id()); EXPECT_EQ(textbox.text(), textbox2.text()); EXPECT_EQ(textbox.fg_color(), textbox2.fg_color()); EXPECT_EQ(textbox.bg_color(), textbox2.bg_color()); @@ -14,7 +13,7 @@ TEST(UI_textbox, to_from_json) TEST(UI_textbox, set_text) { - UI_textbox textbox(std::string("textbox"), std::string("hint"), Color(0, 0, 0), Color(255, 255, 255)); + UI_textbox textbox("hint", Color(0, 0, 0), Color(255, 255, 255)); EXPECT_EQ(textbox.text(), ""); textbox.set_text("random text"); EXPECT_EQ(textbox.text(), "random text"); diff --git a/tests/UI_thermo.cpp b/tests/UI_thermo.cpp index 370d103..b026e90 100644 --- a/tests/UI_thermo.cpp +++ b/tests/UI_thermo.cpp @@ -2,10 +2,9 @@ TEST(UI_thermo, to_from_json) { - UI_thermo thermo("thermo_id", "thermo_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); - json j = thermo.to_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(j); - EXPECT_EQ(thermo.id(), thermo2.id()); EXPECT_EQ(thermo.text(), thermo2.text()); EXPECT_EQ(thermo.fg_color(), thermo2.fg_color()); EXPECT_EQ(thermo.bg_color(), thermo2.bg_color()); @@ -14,7 +13,7 @@ TEST(UI_thermo, to_from_json) TEST(UI_thermo, set_value) { - UI_thermo thermo("thermo_id", "thermo_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); + UI_thermo thermo("thermo_text", Color(255, 255, 255), Color(0, 0, 0), 0, 100, 50); thermo.set_value(75); EXPECT_EQ(thermo.value(), 75); }