Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
The MainWindow_TEST was failing because the requested size of the window
was below the minimum allowed size.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
  • Loading branch information
azeey committed Jan 31, 2025
1 parent 22ddef1 commit 2570a75
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/gz/gui/qml/GzCard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Pane {
/**
* Minimum height of the card pane
*/
property double cardMinimumHeight: content.minimumHeight;
property int cardMinimumHeight: content.minimumHeight;


property double cardMaximumHeight: Infinity
Expand Down
1 change: 0 additions & 1 deletion src/Application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,6 @@ bool Application::AddPluginsToWindow()
Q_ARG(QVariant, QVariant::fromValue(cardItem)));

// Add card to main window
// gzdbg << "Adding to:" << splitItem.toString().toStdString() << std::endl;
cardItem->setParent(this->dataPtr->engine);
plugin->setParent(this->dataPtr->mainWin);

Expand Down
8 changes: 4 additions & 4 deletions src/MainWindow_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,8 @@ TEST(MainWindowTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(ApplyConfig))
WindowConfig c;
// c.posX = 1000;
// c.posY = 2000;
c.width = 100;
c.height = 200;
c.width = 300;
c.height = 400;
c.materialTheme = "Dark";
c.materialPrimary = "#ff0000";
c.materialAccent = "Indigo";
Expand All @@ -765,8 +765,8 @@ TEST(MainWindowTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(ApplyConfig))
// EXPECT_NE(c.posX, 1000);
// EXPECT_NE(c.posY, 2000);

EXPECT_EQ(c.width, 100);
EXPECT_EQ(c.height, 200);
EXPECT_EQ(c.width, 300);
EXPECT_EQ(c.height, 400);
EXPECT_EQ(c.materialTheme, "Dark");
EXPECT_EQ(c.materialPrimary, "#ff0000");
// Always save hex
Expand Down
6 changes: 5 additions & 1 deletion src/Plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ const std::unordered_set<std::string> kAnchorLineSet{
const std::unordered_set<std::string> kIgnoredProps{
"objectName",
"pluginName",
"anchored"};
"anchored",
"floating",
"cardMinimumWidth",
"cardMinimumHeight",
"cardMaximumHeight"};
} // namespace

namespace gz::gui
Expand Down
4 changes: 0 additions & 4 deletions src/Plugin_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,11 @@ TEST(PluginTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(ConfigStrInputNoPlugin))
std::unordered_map<std::string, std::string> pluginTypes;
pluginProps["showTitleBar"] = "true";
pluginProps["resizable"] = "true";
pluginProps["cardMinimumWidth"] = "290";
pluginProps["cardMinimumHeight"] = "110";
pluginProps["z"] = "0";
pluginProps["state"] = "docked";

pluginTypes["showTitleBar"] = "bool";
pluginTypes["resizable"] = "bool";
pluginTypes["cardMinimumWidth"] = "int";
pluginTypes["cardMinimumHeight"] = "int";
pluginTypes["z"] = "double";
pluginTypes["state"] = "string";

Expand Down

0 comments on commit 2570a75

Please sign in to comment.