diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c0e5e8ebc..ca8e90fbf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,19 +2,19 @@ Thank you for considering contributing to TGUI! -All contributions are highly appreciated, whether they are code patches, bug reports or suggestions. Note that while reported bugs are usually handled very quickly, suggestions can sometimes take a long time to be implemented due to TGUI being developed in the spare time of a single developer with only occational code contributions by others. +All contributions are highly appreciated, whether they are code patches, bug reports or suggestions. Note that while reported bugs are usually handled very quickly, suggestions can sometimes take a long time to be implemented due to TGUI being developed in the spare time of a single developer with only occasional code contributions by others. ## Need help? -If you have any questions about TGUI, the [discord server](https://discord.gg/Msf4vyx) and the [forum](https://forum.tgui.eu/) are the best places to get an answer. +If you have any questions about TGUI, the [Discord server](https://discord.gg/Msf4vyx) and the [forum](https://forum.tgui.eu/) are the best places to get an answer. ## Style guide -TGUI has no official style guide yet, but since it's style was heavily influenced by SFML code, the [SFML code style guide](https://www.sfml-dev.org/style.php) mostly matches with TGUI code. +TGUI has no official style guide yet, but since its style was heavily influenced by SFML code, the [SFML code style guide](https://www.sfml-dev.org/style.php) mostly matches with TGUI code. There are 3 differences that I'm aware of: -- TGUI uses `@` in doxygen documentation where SFML uses `\` -- Lines consisting of only shashes (to separate functions) are longer in TGUI -- TGUI code targets c++14 +- TGUI uses `@` in Doxygen documentation where SFML uses `\` +- Lines consisting of only slashes (to separate functions) are longer in TGUI +- TGUI code targets C++14 diff --git a/README.md b/README.md index 2ec3bf39a..7db91fca9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ TGUI - Texus' Graphical User Interface ======================================= -TGUI is a cross-platform modern c++ GUI library. +TGUI is a cross-platform modern C++ GUI library. Although originally a library for SFML, it now also has backends for SDL, GLFW and raylib. For more information, take a look at the [website](https://tgui.eu). diff --git a/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp b/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp index 74afb9448..c73b6756b 100644 --- a/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp +++ b/include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp @@ -83,12 +83,12 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Copy constructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - CanvasSFML(const CanvasSFML& copy); + CanvasSFML(const CanvasSFML& other); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Move constructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - CanvasSFML(CanvasSFML&& copy) noexcept; + CanvasSFML(CanvasSFML&& other) noexcept; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Overload of copy assignment operator diff --git a/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp b/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp index 9cba3ecb5..a5f24bf62 100644 --- a/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp +++ b/include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp @@ -55,7 +55,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Destructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ~BackendGuiGLFW(); + ~BackendGuiGLFW() override; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Inform the gui about a focus event when a callback from glfwSetWindowFocusCallback occurs diff --git a/include/TGUI/Backend/Window/SFML/BackendGuiSFML.hpp b/include/TGUI/Backend/Window/SFML/BackendGuiSFML.hpp index 896ee9ea9..8ee660822 100644 --- a/include/TGUI/Backend/Window/SFML/BackendGuiSFML.hpp +++ b/include/TGUI/Backend/Window/SFML/BackendGuiSFML.hpp @@ -50,7 +50,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Destructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ~BackendGuiSFML(); + ~BackendGuiSFML() override; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Passes the event to the widgets diff --git a/include/TGUI/Container.hpp b/include/TGUI/Container.hpp index c9326b236..c5589c51e 100644 --- a/include/TGUI/Container.hpp +++ b/include/TGUI/Container.hpp @@ -59,12 +59,12 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Copy constructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - Container(const Container& copy); + Container(const Container& other); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Move constructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - Container(Container&& copy) noexcept; + Container(Container&& other) noexcept; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Destructor @@ -204,7 +204,7 @@ namespace tgui /// /// @throw Exception when file could not be opened for writing ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void saveWidgetsToFile(const String& filename); + void saveWidgetsToFile(const String& filename) const; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Loads the child widgets from a string stream diff --git a/include/TGUI/Signal.hpp b/include/TGUI/Signal.hpp index 17d863106..98cb267d2 100644 --- a/include/TGUI/Signal.hpp +++ b/include/TGUI/Signal.hpp @@ -495,7 +495,7 @@ namespace tgui /// /// @return True when a callback function was executed, false when there weren't any connected callback functions ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - bool emit(ChildWindow* param); + bool emit(ChildWindow* childWindow); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private: diff --git a/include/TGUI/Widgets/GrowHorizontalLayout.hpp b/include/TGUI/Widgets/GrowHorizontalLayout.hpp index 10528033b..e2c3c2601 100644 --- a/include/TGUI/Widgets/GrowHorizontalLayout.hpp +++ b/include/TGUI/Widgets/GrowHorizontalLayout.hpp @@ -81,7 +81,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Destructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ~GrowHorizontalLayout() = default; + ~GrowHorizontalLayout() override = default; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Creates a new horizontal layout widget diff --git a/include/TGUI/Widgets/GrowVerticalLayout.hpp b/include/TGUI/Widgets/GrowVerticalLayout.hpp index 8d42a23eb..278c9afe5 100644 --- a/include/TGUI/Widgets/GrowVerticalLayout.hpp +++ b/include/TGUI/Widgets/GrowVerticalLayout.hpp @@ -81,7 +81,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Destructor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ~GrowVerticalLayout() = default; + ~GrowVerticalLayout() override = default; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Creates a new vertical layout widget diff --git a/src/Backend/Renderer/BackendText.cpp b/src/Backend/Renderer/BackendText.cpp index 1449e059b..b83e7f68d 100644 --- a/src/Backend/Renderer/BackendText.cpp +++ b/src/Backend/Renderer/BackendText.cpp @@ -220,6 +220,7 @@ namespace tgui case ' ': position.x += whitespaceWidth; continue; case '\t': position.x += whitespaceWidth * 4; continue; case '\n': position.y += lineSpacing; position.x = 0; continue; + default: break; } // For regular characters, add the advance offset of the glyph @@ -365,6 +366,8 @@ namespace tgui x = 0; y += lineSpacing; break; + default: + break; } // Next glyph, no need to create a quad for whitespace diff --git a/src/Components.cpp b/src/Components.cpp index 9a9ce608e..b46e58688 100644 --- a/src/Components.cpp +++ b/src/Components.cpp @@ -251,7 +251,6 @@ namespace dev GroupComponent::GroupComponent(const GroupComponent& other) : Component{other}, - m_children{}, m_clientSize(other.m_clientSize) { /// TODO: If this GroupComponent is a BackgroundComponent which contains a TextComponent, and this group is being copied diff --git a/src/Container.cpp b/src/Container.cpp index 5d8e2d5d6..caa6a13f3 100644 --- a/src/Container.cpp +++ b/src/Container.cpp @@ -500,7 +500,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void Container::saveWidgetsToFile(const String& filename) + void Container::saveWidgetsToFile(const String& filename) const { // If a resource path is set then place it in front of the filename (unless the filename is an absolute path) String filenameInResources = filename; diff --git a/src/Loading/DataIO.cpp b/src/Loading/DataIO.cpp index b348f40e3..aa2f09591 100644 --- a/src/Loading/DataIO.cpp +++ b/src/Loading/DataIO.cpp @@ -577,10 +577,10 @@ namespace tgui void DataIO::emit(const std::unique_ptr& rootNode, std::stringstream& stream) { for (const auto& pair : rootNode->propertyValuePairs) - stream << pair.first << " = " << pair.second->value << ";" << std::endl; + stream << pair.first << " = " << pair.second->value << ";\n"; if (!rootNode->propertyValuePairs.empty() && !rootNode->children.empty()) - stream << std::endl; + stream << '\n'; std::vector output; for (std::size_t i = 0; i < rootNode->children.size(); ++i) @@ -593,7 +593,7 @@ namespace tgui } for (const auto& line : output) - stream << line << std::endl; + stream << line << '\n'; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Loading/Deserializer.cpp b/src/Loading/Deserializer.cpp index 482c0a309..1c2da5546 100644 --- a/src/Loading/Deserializer.cpp +++ b/src/Loading/Deserializer.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/src/Loading/Theme.cpp b/src/Loading/Theme.cpp index f5e88c49e..1c97d5145 100644 --- a/src/Loading/Theme.cpp +++ b/src/Loading/Theme.cpp @@ -23,7 +23,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include #include ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -585,7 +584,6 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Theme::Theme(const Theme& other) : - m_renderers {}, m_globalProperties{other.m_globalProperties}, m_primary {other.m_primary} { diff --git a/src/Loading/ThemeLoader.cpp b/src/Loading/ThemeLoader.cpp index 3cc063ca8..31ba16ed1 100644 --- a/src/Loading/ThemeLoader.cpp +++ b/src/Loading/ThemeLoader.cpp @@ -27,7 +27,6 @@ #include #include -#include // Ignore warning "C4503: decorated name length exceeded, name was truncated" in Visual Studio #if defined _MSC_VER diff --git a/src/Renderers/BoxLayoutRenderer.cpp b/src/Renderers/BoxLayoutRenderer.cpp index d72c2661d..8d85324f0 100644 --- a/src/Renderers/BoxLayoutRenderer.cpp +++ b/src/Renderers/BoxLayoutRenderer.cpp @@ -23,7 +23,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Signal.cpp b/src/Signal.cpp index baecbe28b..3f8ef1adc 100644 --- a/src/Signal.cpp +++ b/src/Signal.cpp @@ -40,8 +40,8 @@ namespace tgui Signal::Signal(const Signal& other) : m_enabled {other.m_enabled}, - m_name {other.m_name}, - m_handlers{} // signal handlers are not copied with the widget + m_name {other.m_name} + // signal handlers are not copied with the widget { } diff --git a/src/String.cpp b/src/String.cpp index bc528d11e..dd627c2a1 100644 --- a/src/String.cpp +++ b/src/String.cpp @@ -348,8 +348,9 @@ namespace tgui } else // When the delimeter is empty, each character is put in its own part { + substrings.reserve(m_string.size()); for (const char32_t c : m_string) - substrings.push_back(c); + substrings.emplace_back(c); } if (trim) diff --git a/src/Widget.cpp b/src/Widget.cpp index 3072f8648..9d1daed8b 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -172,8 +172,6 @@ namespace tgui m_scaleOrigin {other.m_scaleOrigin}, m_scaleFactors {other.m_scaleFactors}, m_rotationDeg {other.m_rotationDeg}, - m_boundPositionLayouts {}, - m_boundSizeLayouts {}, m_enabled {other.m_enabled}, m_visible {other.m_visible}, m_parent {nullptr}, @@ -181,7 +179,6 @@ namespace tgui m_containerWidget {other.m_containerWidget}, m_toolTip {other.m_toolTip ? other.m_toolTip->clone() : nullptr}, m_renderer {other.m_renderer}, - m_showAnimations {}, m_userData {other.m_userData}, m_mouseCursor {other.m_mouseCursor}, m_autoLayout {other.m_autoLayout}, diff --git a/src/Widgets/BoxLayout.cpp b/src/Widgets/BoxLayout.cpp index 8db382949..578a927a4 100644 --- a/src/Widgets/BoxLayout.cpp +++ b/src/Widgets/BoxLayout.cpp @@ -23,7 +23,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Widgets/ButtonBase.cpp b/src/Widgets/ButtonBase.cpp index ef348c6ff..c78f21a81 100644 --- a/src/Widgets/ButtonBase.cpp +++ b/src/Widgets/ButtonBase.cpp @@ -64,12 +64,8 @@ namespace tgui m_textOrigin {other.m_textOrigin}, background {other.background}, text {other.text}, - m_stylePropertiesNames {}, - m_stylePropertiesGlobalNames {}, - m_namedComponents {}, m_backgroundComponent {std::make_shared(*other.m_backgroundComponent, &background)}, - m_textComponent {std::make_shared(*other.m_textComponent, &text)}, - m_components {} + m_textComponent {std::make_shared(*other.m_textComponent, &text)} { ButtonBase::initComponents(); } @@ -87,12 +83,8 @@ namespace tgui m_textOrigin {std::move(other.m_textOrigin)}, background {std::move(other.background)}, text {std::move(other.text)}, - m_stylePropertiesNames {}, - m_stylePropertiesGlobalNames {}, - m_namedComponents {}, m_backgroundComponent {std::make_shared(*other.m_backgroundComponent, &background)}, - m_textComponent {std::make_shared(*other.m_textComponent, &text)}, - m_components {} + m_textComponent {std::make_shared(*other.m_textComponent, &text)} { ButtonBase::initComponents(); } diff --git a/src/Widgets/EditBox.cpp b/src/Widgets/EditBox.cpp index 72d638bfc..c83b2e749 100644 --- a/src/Widgets/EditBox.cpp +++ b/src/Widgets/EditBox.cpp @@ -23,7 +23,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include #include #include diff --git a/src/Widgets/Grid.cpp b/src/Widgets/Grid.cpp index 196014d50..46860f44f 100644 --- a/src/Widgets/Grid.cpp +++ b/src/Widgets/Grid.cpp @@ -44,14 +44,7 @@ namespace tgui Grid::Grid(const Grid& gridToCopy) : Container {gridToCopy}, - m_autoSize {gridToCopy.m_autoSize}, - m_gridWidgets {}, - m_objPadding {}, - m_objAlignment{}, - m_rowHeight {}, - m_columnWidth {}, - m_widgetCells {}, - m_connectedSizeCallbacks{} + m_autoSize {gridToCopy.m_autoSize} { for (std::size_t i = 0; i < m_widgets.size(); ++i) { diff --git a/src/Widgets/GrowHorizontalLayout.cpp b/src/Widgets/GrowHorizontalLayout.cpp index 5887f9aa8..18603cc3e 100644 --- a/src/Widgets/GrowHorizontalLayout.cpp +++ b/src/Widgets/GrowHorizontalLayout.cpp @@ -47,8 +47,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// GrowHorizontalLayout::GrowHorizontalLayout(const GrowHorizontalLayout& other) : - BoxLayout {other}, - m_widgetLayouts{} + BoxLayout {other} { GrowHorizontalLayout::updateWidgets(); } @@ -56,8 +55,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// GrowHorizontalLayout::GrowHorizontalLayout(GrowHorizontalLayout&& other) noexcept : - BoxLayout {std::move(other)}, - m_widgetLayouts{} + BoxLayout {std::move(other)} { GrowHorizontalLayout::updateWidgets(); } diff --git a/src/Widgets/GrowVerticalLayout.cpp b/src/Widgets/GrowVerticalLayout.cpp index 7cc34a6d1..ce8fadca5 100644 --- a/src/Widgets/GrowVerticalLayout.cpp +++ b/src/Widgets/GrowVerticalLayout.cpp @@ -47,8 +47,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// GrowVerticalLayout::GrowVerticalLayout(const GrowVerticalLayout& other) : - BoxLayout {other}, - m_widgetLayouts{} + BoxLayout {other} { GrowVerticalLayout::updateWidgets(); } @@ -56,8 +55,7 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// GrowVerticalLayout::GrowVerticalLayout(GrowVerticalLayout&& other) noexcept : - BoxLayout {std::move(other)}, - m_widgetLayouts{} + BoxLayout {std::move(other)} { GrowVerticalLayout::updateWidgets(); } diff --git a/src/Widgets/Label.cpp b/src/Widgets/Label.cpp index 580e77c78..1c23e6b5f 100644 --- a/src/Widgets/Label.cpp +++ b/src/Widgets/Label.cpp @@ -113,9 +113,9 @@ namespace tgui ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void Label::setText(const String& string) + void Label::setText(const String& text) { - m_string = string; + m_string = text; rearrangeText(); } diff --git a/src/Widgets/ListView.cpp b/src/Widgets/ListView.cpp index a4ecc1489..846ac0196 100644 --- a/src/Widgets/ListView.cpp +++ b/src/Widgets/ListView.cpp @@ -2479,13 +2479,8 @@ namespace tgui if (m_columns.empty() || m_expandLastColumn) return true; - for (const auto& column : m_columns) - { - if (column.expanded) - return true; - } - - return false; + return std::any_of(m_columns.cbegin(), m_columns.cend(), + [](const auto& column) { return column.expanded; }); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Widgets/RadioButtonGroup.cpp b/src/Widgets/RadioButtonGroup.cpp index bf3e341fb..2030127dc 100644 --- a/src/Widgets/RadioButtonGroup.cpp +++ b/src/Widgets/RadioButtonGroup.cpp @@ -23,6 +23,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include +#include ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -95,13 +96,8 @@ namespace tgui return false; const Vector2f offset = getChildWidgetsOffset(); - for (const auto& widget : m_widgets) - { - if (widget->isVisible() && widget->isMouseOnWidget(transformMousePos(widget, pos - offset))) - return true; - } - - return false; + return std::any_of(m_widgets.cbegin(), m_widgets.cend(), + [&](const auto& widget) { return widget->isVisible() && widget->isMouseOnWidget(transformMousePos(widget, pos - offset)); }); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Widgets/RichTextLabel.cpp b/src/Widgets/RichTextLabel.cpp index 1bb2cd82a..347446b3c 100644 --- a/src/Widgets/RichTextLabel.cpp +++ b/src/Widgets/RichTextLabel.cpp @@ -25,7 +25,6 @@ #include #include -#include ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Widgets/ScrollablePanel.cpp b/src/Widgets/ScrollablePanel.cpp index 3a3d4d1e5..7f0d5f12c 100644 --- a/src/Widgets/ScrollablePanel.cpp +++ b/src/Widgets/ScrollablePanel.cpp @@ -27,7 +27,6 @@ #include #include -#include ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -59,11 +58,7 @@ namespace tgui m_verticalScrollAmount {other.m_verticalScrollAmount}, m_horizontalScrollAmount {other.m_horizontalScrollAmount}, m_verticalScrollbarWasVisibleOnSizeUpdate{other.m_verticalScrollbarWasVisibleOnSizeUpdate}, - m_horizontalScrollbarWasVisibleOnSizeUpdate{other.m_horizontalScrollbarWasVisibleOnSizeUpdate}, - m_recalculatingSizeDuringUpdateScrollbars{false}, - m_stuckInUpdateScrollbars {false}, - m_connectedPositionCallbacks{}, - m_connectedSizeCallbacks {} + m_horizontalScrollbarWasVisibleOnSizeUpdate{other.m_horizontalScrollbarWasVisibleOnSizeUpdate} { if (m_contentSize == Vector2f{0, 0}) { @@ -83,8 +78,6 @@ namespace tgui m_horizontalScrollAmount {std::move(other.m_horizontalScrollAmount)}, m_verticalScrollbarWasVisibleOnSizeUpdate{std::move(other.m_verticalScrollbarWasVisibleOnSizeUpdate)}, m_horizontalScrollbarWasVisibleOnSizeUpdate{std::move(other.m_horizontalScrollbarWasVisibleOnSizeUpdate)}, - m_recalculatingSizeDuringUpdateScrollbars{false}, - m_stuckInUpdateScrollbars {false}, m_connectedPositionCallbacks{std::move(other.m_connectedPositionCallbacks)}, m_connectedSizeCallbacks {std::move(other.m_connectedSizeCallbacks)} { diff --git a/src/Widgets/Tabs.cpp b/src/Widgets/Tabs.cpp index b95de2f89..f01effd66 100644 --- a/src/Widgets/Tabs.cpp +++ b/src/Widgets/Tabs.cpp @@ -23,7 +23,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include #include #include diff --git a/tests/Clipboard.cpp b/tests/Clipboard.cpp index 1bfff626b..7c4ed4fd7 100644 --- a/tests/Clipboard.cpp +++ b/tests/Clipboard.cpp @@ -29,5 +29,5 @@ TEST_CASE("[Clipboard]") tgui::getBackend()->setClipboard("Some text"); REQUIRE(getClipboardContents() == "Some text"); tgui::getBackend()->setClipboard(""); - REQUIRE(getClipboardContents() == ""); + REQUIRE(getClipboardContents().empty()); } diff --git a/tests/CompareFiles.cpp b/tests/CompareFiles.cpp index bb4b7a30a..7345bb347 100644 --- a/tests/CompareFiles.cpp +++ b/tests/CompareFiles.cpp @@ -51,9 +51,9 @@ void compareImageFiles(const tgui::String& filename1, const tgui::String& filena for (unsigned int x = 0; x < imageSize1.x; ++x) { const unsigned int index = ((y * x) + x) * 4; - totalDiff += std::abs(int(imagePixels1[index+0]) - int(imagePixels2[index+0])) / 255.0; - totalDiff += std::abs(int(imagePixels1[index+1]) - int(imagePixels2[index+1])) / 255.0; - totalDiff += std::abs(int(imagePixels1[index+2]) - int(imagePixels2[index+2])) / 255.0; + totalDiff += std::abs(static_cast(imagePixels1[index+0]) - static_cast(imagePixels2[index+0])) / 255.0; + totalDiff += std::abs(static_cast(imagePixels1[index+1]) - static_cast(imagePixels2[index+1])) / 255.0; + totalDiff += std::abs(static_cast(imagePixels1[index+2]) - static_cast(imagePixels2[index+2])) / 255.0; } } @@ -65,12 +65,12 @@ void compareImageFiles(const tgui::String& filename1, const tgui::String& filena // The compareFiles can't be used to compare empty files because it uses readFileToMemory which // requires the file to have some contents. -bool compareFiles(const tgui::String& filename1, const tgui::String& filename2) +bool compareFiles(const tgui::String& leftFileName, const tgui::String& rightFileName) { std::size_t fileSize1; std::size_t fileSize2; - auto fileContents1 = tgui::readFileToMemory(filename1, fileSize1); - auto fileContents2 = tgui::readFileToMemory(filename2, fileSize2); + auto fileContents1 = tgui::readFileToMemory(leftFileName, fileSize1); + auto fileContents2 = tgui::readFileToMemory(rightFileName, fileSize2); if (!fileContents1 || !fileContents2) return false; diff --git a/tests/Container.cpp b/tests/Container.cpp index d35362b00..a136cf28a 100644 --- a/tests/Container.cpp +++ b/tests/Container.cpp @@ -69,7 +69,7 @@ TEST_CASE("[Container]") REQUIRE(container->getWidgets().size() == 3); REQUIRE(container->getWidgets()[0]->getWidgetName() == "widget1"); - REQUIRE(container->getWidgets()[1]->getWidgetName() == ""); + REQUIRE(container->getWidgets()[1]->getWidgetName().empty()); REQUIRE(container->getWidgets()[2]->getWidgetName() == "widget3"); } diff --git a/tests/Filesystem.cpp b/tests/Filesystem.cpp index 1568c188f..ae0726b6e 100644 --- a/tests/Filesystem.cpp +++ b/tests/Filesystem.cpp @@ -39,7 +39,7 @@ TEST_CASE("[Filesystem]") REQUIRE(tgui::Filesystem::Path("/x").getParentPath().asString() == "/"); REQUIRE(tgui::Filesystem::Path("/").getParentPath().asString() == "/"); - REQUIRE(tgui::Filesystem::Path("x").getParentPath().asString() == ""); + REQUIRE(tgui::Filesystem::Path("x").getParentPath().asString().empty()); REQUIRE(!tgui::Filesystem::Path("/a/b/c").isEmpty()); REQUIRE(tgui::Filesystem::Path("").isEmpty()); diff --git a/tests/Loading/DataIO.cpp b/tests/Loading/DataIO.cpp index f30ee5648..fe2960757 100644 --- a/tests/Loading/DataIO.cpp +++ b/tests/Loading/DataIO.cpp @@ -263,25 +263,25 @@ TEST_CASE("[DataIO]") SECTION("direct stream") { - stream << "GlobalProperty1 = GlobalValue1;" << std::endl; - stream << "GlobalProperty2 = GlobalValue2;" << std::endl; - stream << "Child1" << std::endl; - stream << "{" << std::endl; - stream << "Property = Value;" << std::endl; - stream << "NestedChild" << std::endl; - stream << "{" << std::endl; - stream << "PropertyA = ValueA;" << std::endl; - stream << "PropertyB = [];" << std::endl; - stream << "PropertyC = [X, Y, Z];" << std::endl; - stream << "}" << std::endl; - stream << "}" << std::endl; - stream << "{" << std::endl; - stream << "}" << std::endl; + stream << "GlobalProperty1 = GlobalValue1;\n"; + stream << "GlobalProperty2 = GlobalValue2;\n"; + stream << "Child1\n"; + stream << "{\n"; + stream << "Property = Value;\n"; + stream << "NestedChild\n"; + stream << "{\n"; + stream << "PropertyA = ValueA;\n"; + stream << "PropertyB = [];\n"; + stream << "PropertyC = [X, Y, Z];\n"; + stream << "}\n"; + stream << "}\n"; + stream << "{\n"; + stream << "}\n"; } // Check that emit function works correctly by parsing the result and check if it equals the input auto parsedRoot = tgui::DataIO::parse(stream); - REQUIRE(parsedRoot->name == ""); // Root node name is ignored when saving + REQUIRE(parsedRoot->name.empty()); // Root node name is ignored when saving REQUIRE(parsedRoot->parent == nullptr); REQUIRE(parsedRoot->children.size() == 2); REQUIRE(parsedRoot->propertyValuePairs.size() == 2); @@ -310,7 +310,7 @@ TEST_CASE("[DataIO]") REQUIRE(parsedRoot->children[0]->children[0]->propertyValuePairs["PropertyC"]->valueList[0] == "X"); REQUIRE(parsedRoot->children[0]->children[0]->propertyValuePairs["PropertyC"]->valueList[1] == "Y"); REQUIRE(parsedRoot->children[0]->children[0]->propertyValuePairs["PropertyC"]->valueList[2] == "Z"); - REQUIRE(parsedRoot->children[1]->name == ""); + REQUIRE(parsedRoot->children[1]->name.empty()); REQUIRE(parsedRoot->children[1]->parent == parsedRoot.get()); REQUIRE(parsedRoot->children[1]->children.empty()); REQUIRE(parsedRoot->children[1]->propertyValuePairs.empty()); diff --git a/tests/Loading/Deserializer.cpp b/tests/Loading/Deserializer.cpp index 76d96576c..935ebc188 100644 --- a/tests/Loading/Deserializer.cpp +++ b/tests/Loading/Deserializer.cpp @@ -89,7 +89,7 @@ TEST_CASE("[Deserializer]") SECTION("deserialize string") { - REQUIRE(tgui::Deserializer::deserialize(Type::String, "\"\"").getString() == ""); + REQUIRE(tgui::Deserializer::deserialize(Type::String, "\"\"").getString().empty()); REQUIRE(tgui::Deserializer::deserialize(Type::String, "\"Just a string.\"").getString() == "Just a string."); REQUIRE(tgui::Deserializer::deserialize(Type::String, "\"\\\\\"").getString() == "\\"); REQUIRE(tgui::Deserializer::deserialize(Type::String, "\"\\n\"").getString() == "\n"); @@ -98,7 +98,7 @@ TEST_CASE("[Deserializer]") REQUIRE(tgui::Deserializer::deserialize(Type::String, "\"\\\"\"").getString() == "\""); REQUIRE(tgui::Deserializer::deserialize(Type::String, "\"a\\t\\\"str\\\"?\\nYES!\"").getString() == "a\t\"str\"?\nYES!"); - REQUIRE(tgui::Deserializer::deserialize(Type::String, "").getString() == ""); + REQUIRE(tgui::Deserializer::deserialize(Type::String, "").getString().empty()); REQUIRE(tgui::Deserializer::deserialize(Type::String, "\\").getString() == "\\"); REQUIRE(tgui::Deserializer::deserialize(Type::String, "\\n").getString() == "\\n"); REQUIRE(tgui::Deserializer::deserialize(Type::String, "str").getString() == "str"); diff --git a/tests/Loading/Theme.cpp b/tests/Loading/Theme.cpp index 1a9333da0..b29d1232e 100644 --- a/tests/Loading/Theme.cpp +++ b/tests/Loading/Theme.cpp @@ -33,7 +33,7 @@ TEST_CASE("[Theme]") SECTION("Renderers are shared") { tgui::Theme theme; - REQUIRE(theme.getPrimary() == ""); + REQUIRE(theme.getPrimary().empty()); REQUIRE_NOTHROW(theme.getRenderer("Button")); REQUIRE_NOTHROW(theme.load("resources/Black.txt")); @@ -199,7 +199,7 @@ TEST_CASE("[Theme]") const std::map& load(const tgui::String& one, const tgui::String& two) override { - if (one != "") + if (!one.empty()) { REQUIRE(one == "resources/Black.txt"); REQUIRE(two == "EditBox"); diff --git a/tests/Loading/ThemeLoader.cpp b/tests/Loading/ThemeLoader.cpp index 216acb1b1..accef69ed 100644 --- a/tests/Loading/ThemeLoader.cpp +++ b/tests/Loading/ThemeLoader.cpp @@ -46,7 +46,7 @@ TEST_CASE("[ThemeLoader]") SECTION("load black theme") { - REQUIRE(loader->load("resources/Black.txt", "EditBox").size() > 0); + REQUIRE(!loader->load("resources/Black.txt", "EditBox").empty()); } SECTION("load nonexistent theme") @@ -112,7 +112,7 @@ TEST_CASE("[ThemeLoader]") SECTION("cache") { - REQUIRE(loader->getPropertiesCache().size() == 0); + REQUIRE(loader->getPropertiesCache().empty()); SECTION("with preload") { @@ -152,7 +152,7 @@ TEST_CASE("[ThemeLoader]") REQUIRE(propertyCache.size() == 2); tgui::DefaultThemeLoader::flushCache(); - REQUIRE(propertyCache.size() == 0); + REQUIRE(propertyCache.empty()); } SECTION("without preload") @@ -183,7 +183,7 @@ TEST_CASE("[ThemeLoader]") REQUIRE(loader->getPropertiesCache().size() == 2); tgui::DefaultThemeLoader::flushCache(); - REQUIRE(loader->getPropertiesCache().size() == 0); + REQUIRE(loader->getPropertiesCache().empty()); } } } diff --git a/tests/String.cpp b/tests/String.cpp index 23dcd0b8e..a822c6481 100644 --- a/tests/String.cpp +++ b/tests/String.cpp @@ -1390,7 +1390,7 @@ TEST_CASE("[String]") istream >> str1 >> str2 >> str3; REQUIRE(str1 == "abc1"); REQUIRE(str2 == "2"); - REQUIRE(str3 == ""); + REQUIRE(str3.empty()); std::wstringbuf wstreambuf; std::wostream wostream(&wstreambuf); @@ -1402,7 +1402,7 @@ TEST_CASE("[String]") wistream >> str1 >> str2 >> str3; REQUIRE(str1 == L"\u03b1\u03b2\u03b3\u03b4\u03b53"); REQUIRE(str2 == "4"); - REQUIRE(str3 == ""); + REQUIRE(str3.empty()); } SECTION("attemptToInt") @@ -1495,7 +1495,7 @@ TEST_CASE("[String]") REQUIRE(str.trim() == "a"); str = ""; - REQUIRE(str.trim() == ""); + REQUIRE(str.trim().empty()); } SECTION("toLower") @@ -1546,7 +1546,7 @@ TEST_CASE("[String]") parts = tgui::String("").split(','); REQUIRE(parts.size() == 1); - REQUIRE(parts[0] == ""); + REQUIRE(parts[0].empty()); parts = tgui::String("a|b").split('|'); REQUIRE(parts.size() == 2); @@ -1569,8 +1569,8 @@ TEST_CASE("[String]") { REQUIRE(tgui::String::join({"alpha", "bravo", "charlie"}, ", ") == "alpha, bravo, charlie"); REQUIRE(tgui::String::join({"xyz"}, ", ") == "xyz"); - REQUIRE(tgui::String::join({""}, ", ") == ""); - REQUIRE(tgui::String::join({}, ", ") == ""); + REQUIRE(tgui::String::join({""}, ", ").empty()); + REQUIRE(tgui::String::join({}, ", ").empty()); } SECTION("starts_with") @@ -1664,21 +1664,21 @@ TEST_CASE("[String]") SECTION("Invalid characters") { - REQUIRE(tgui::String(U"\x200000").toUtf16() == u""); - REQUIRE(tgui::String(U"\xDBFF").toUtf16() == u""); + REQUIRE(tgui::String(U"\x200000").toUtf16().empty()); + REQUIRE(tgui::String(U"\xDBFF").toUtf16().empty()); TGUI_IF_CONSTEXPR (sizeof(wchar_t) == 2) { - REQUIRE(tgui::String(U"\x200000").toWideString() == L""); - REQUIRE(tgui::String(U"\xDBFF").toWideString() == L""); + REQUIRE(tgui::String(U"\x200000").toWideString().empty()); + REQUIRE(tgui::String(U"\xDBFF").toWideString().empty()); } - REQUIRE(tgui::String(U"\x200000").toStdString() == ""); - REQUIRE(tgui::String(U"\xDBFF").toStdString() == ""); + REQUIRE(tgui::String(U"\x200000").toStdString().empty()); + REQUIRE(tgui::String(U"\xDBFF").toStdString().empty()); - REQUIRE(tgui::String(u"\xDBFF") == u""); - REQUIRE(tgui::String(u"\xDBFF\x1234") == u""); + REQUIRE(tgui::String(u"\xDBFF").empty()); + REQUIRE(tgui::String(u"\xDBFF\x1234").empty()); - REQUIRE(tgui::String("\xE2\x82") == ""); + REQUIRE(tgui::String("\xE2\x82").empty()); } } diff --git a/tests/Text.cpp b/tests/Text.cpp index 800fe9c63..b5c7ec312 100644 --- a/tests/Text.cpp +++ b/tests/Text.cpp @@ -30,7 +30,7 @@ TEST_CASE("[Text]") SECTION("String") { - REQUIRE(text.getString() == ""); + REQUIRE(text.getString().empty()); text.setString("MyString"); REQUIRE(text.getString() == "MyString"); } diff --git a/tests/Texture.cpp b/tests/Texture.cpp index 0d407c19b..7bdb91ba1 100644 --- a/tests/Texture.cpp +++ b/tests/Texture.cpp @@ -76,7 +76,7 @@ TEST_CASE("[Texture]") REQUIRE_THROWS_AS(texture.loadFromBase64("aW52YWxpZA=="), tgui::Exception); } - REQUIRE(texture.getId() == ""); + REQUIRE(texture.getId().empty()); REQUIRE(texture.getData() == nullptr); REQUIRE(texture.getImageSize() == tgui::Vector2u(0, 0)); REQUIRE(texture.getMiddleRect() == tgui::UIntRect()); @@ -131,7 +131,7 @@ TEST_CASE("[Texture]") "4HlUEWCC5RnkpQCuR5SusF3k2bBZ5Vvb6g3fRYlPFx/HVi+GVuyp/xGBYCeingL7Z7eXxcGPU7nQnkd1Wpa2KGFVVzwP0He9jbbHIs1F92izF1" "DgX82Wtol69PFp4HdDFeP52wO7DyejNXUryK3Qc1fC2yLPNP07syl9AO0Z/M+q1lNhW2sSkyLPhrNifn2O2xjCyiUUAAAAASUVORK5CYII=", {2, 1, 6, 5}, {1, 2, 4, 1}, false); - REQUIRE(texture.getId() == ""); + REQUIRE(texture.getId().empty()); REQUIRE(texture.getData() != nullptr); REQUIRE(texture.getData()->backendTexture != nullptr); REQUIRE(texture.getPartRect() == tgui::UIntRect(2, 1, 6, 5)); diff --git a/tests/Widget.cpp b/tests/Widget.cpp index 38d1231ae..ce467ab55 100644 --- a/tests/Widget.cpp +++ b/tests/Widget.cpp @@ -81,7 +81,7 @@ TEST_CASE("[Widget]") panel2->add(widget); std::cerr.rdbuf(oldbuf); REQUIRE(widget->getParent() == panel2.get()); - REQUIRE(panel1->getWidgets().size() == 0); + REQUIRE(panel1->getWidgets().empty()); } SECTION("ParentGui") @@ -346,7 +346,7 @@ TEST_CASE("[Widget]") auto w2 = tgui::ClickableWidget::create(); auto w3 = tgui::ClickableWidget::create(); - REQUIRE(w1->getWidgetName() == ""); + REQUIRE(w1->getWidgetName().empty()); w1->setWidgetName("Nr_1"); w2->setWidgetName("Nr_2"); diff --git a/tests/Widgets/BitmapButton.cpp b/tests/Widgets/BitmapButton.cpp index ad22d906c..4bce18aaf 100644 --- a/tests/Widgets/BitmapButton.cpp +++ b/tests/Widgets/BitmapButton.cpp @@ -56,7 +56,7 @@ TEST_CASE("[BitmapButton]") SECTION("Text") { - REQUIRE(button->getText() == ""); + REQUIRE(button->getText().empty()); button->setText("SomeText"); REQUIRE(button->getText() == "SomeText"); } diff --git a/tests/Widgets/Button.cpp b/tests/Widgets/Button.cpp index 3643e6840..4d9563483 100644 --- a/tests/Widgets/Button.cpp +++ b/tests/Widgets/Button.cpp @@ -56,7 +56,7 @@ TEST_CASE("[Button]") SECTION("Text") { - REQUIRE(button->getText() == ""); + REQUIRE(button->getText().empty()); button->setText("SomeText"); REQUIRE(button->getText() == "SomeText"); } diff --git a/tests/Widgets/ChatBox.cpp b/tests/Widgets/ChatBox.cpp index 43967a7c1..5a22e2a16 100644 --- a/tests/Widgets/ChatBox.cpp +++ b/tests/Widgets/ChatBox.cpp @@ -163,7 +163,7 @@ TEST_CASE("[ChatBox]") chatBox->setTextColor(tgui::Color::Yellow); chatBox->addLine("Text", tgui::Color::Blue); - REQUIRE(chatBox->getLine(1) == ""); + REQUIRE(chatBox->getLine(1).empty()); REQUIRE(chatBox->getLineColor(1) == tgui::Color::Yellow); } diff --git a/tests/Widgets/ChildWindow.cpp b/tests/Widgets/ChildWindow.cpp index c2fc455dd..723c01613 100644 --- a/tests/Widgets/ChildWindow.cpp +++ b/tests/Widgets/ChildWindow.cpp @@ -159,7 +159,7 @@ TEST_CASE("[ChildWindow]") SECTION("Title") { - REQUIRE(childWindow->getTitle() == ""); + REQUIRE(childWindow->getTitle().empty()); childWindow->setTitle("Title Text"); REQUIRE(childWindow->getTitle() == "Title Text"); } @@ -239,7 +239,7 @@ TEST_CASE("[ChildWindow]") childWindow->setCloseBehavior(tgui::ChildWindow::CloseBehavior::Remove); REQUIRE(childWindow->getCloseBehavior() == tgui::ChildWindow::CloseBehavior::Remove); childWindow->close(); - REQUIRE(parent->getWidgets().size() == 0); + REQUIRE(parent->getWidgets().empty()); REQUIRE(childWindow->isVisible()); parent->add(childWindow); diff --git a/tests/Widgets/ComboBox.cpp b/tests/Widgets/ComboBox.cpp index de50515bf..5b464df13 100644 --- a/tests/Widgets/ComboBox.cpp +++ b/tests/Widgets/ComboBox.cpp @@ -71,13 +71,13 @@ TEST_CASE("[ComboBox]") REQUIRE(comboBox->getItemById("1") == "Item 1"); REQUIRE(comboBox->getItemById("2") == "Item 2"); - REQUIRE(comboBox->getItemById("3") == ""); + REQUIRE(comboBox->getItemById("3").empty()); comboBox->addMultipleItems({"Item 4", "Item 5", "Item 6", "Item 7"}); REQUIRE(comboBox->getItemCount() == 7); REQUIRE(comboBox->getItems()[3] == "Item 4"); REQUIRE(comboBox->getItems()[6] == "Item 7"); - REQUIRE(comboBox->getIdByIndex(6) == ""); + REQUIRE(comboBox->getIdByIndex(6).empty()); comboBox->addMultipleItems({}); REQUIRE(comboBox->getItemCount() == 7); @@ -91,16 +91,16 @@ TEST_CASE("[ComboBox]") REQUIRE(comboBox->getItems()[0] == "Item 1"); REQUIRE(comboBox->getItemById("1") == "Item 1"); - REQUIRE(comboBox->getItemById("3") == ""); + REQUIRE(comboBox->getItemById("3").empty()); REQUIRE(comboBox->getItemByIndex(1) == "Item 2"); - REQUIRE(comboBox->getItemByIndex(2) == ""); + REQUIRE(comboBox->getItemByIndex(2).empty()); REQUIRE(comboBox->getIndexById("1") == 0); REQUIRE(comboBox->getIndexById("3") == -1); REQUIRE(comboBox->getIdByIndex(1) == "2"); - REQUIRE(comboBox->getIdByIndex(2) == ""); + REQUIRE(comboBox->getIdByIndex(2).empty()); } SECTION("Removing items") @@ -188,8 +188,8 @@ TEST_CASE("[ComboBox]") comboBox->addItem("Item 2", "2"); comboBox->addItem("Item 3", "3"); - REQUIRE(comboBox->getSelectedItem() == ""); - REQUIRE(comboBox->getSelectedItemId() == ""); + REQUIRE(comboBox->getSelectedItem().empty()); + REQUIRE(comboBox->getSelectedItemId().empty()); REQUIRE(comboBox->getSelectedItemIndex() == -1); REQUIRE(!comboBox->setSelectedItem("Item 0")); @@ -214,8 +214,8 @@ TEST_CASE("[ComboBox]") REQUIRE(comboBox->getSelectedItemIndex() == 2); comboBox->deselectItem(); - REQUIRE(comboBox->getSelectedItem() == ""); - REQUIRE(comboBox->getSelectedItemId() == ""); + REQUIRE(comboBox->getSelectedItem().empty()); + REQUIRE(comboBox->getSelectedItemId().empty()); REQUIRE(comboBox->getSelectedItemIndex() == -1); } diff --git a/tests/Widgets/EditBox.cpp b/tests/Widgets/EditBox.cpp index b5a46edb0..eb287126e 100644 --- a/tests/Widgets/EditBox.cpp +++ b/tests/Widgets/EditBox.cpp @@ -73,14 +73,14 @@ TEST_CASE("[EditBox]") SECTION("Text") { - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setText("SomeText"); REQUIRE(editBox->getText() == "SomeText"); } SECTION("DefaultText") { - REQUIRE(editBox->getDefaultText() == ""); + REQUIRE(editBox->getDefaultText().empty()); editBox->setDefaultText("SomeDefaultText"); REQUIRE(editBox->getDefaultText() == "SomeDefaultText"); } @@ -215,7 +215,7 @@ TEST_CASE("[EditBox]") { REQUIRE(editBox->setInputValidator(tgui::EditBox::Validator::Int)); REQUIRE(editBox->getInputValidator() == tgui::EditBox::Validator::Int); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setText("-5"); REQUIRE(editBox->getText() == "-5"); @@ -224,10 +224,10 @@ TEST_CASE("[EditBox]") REQUIRE(editBox->getText() == "642"); editBox->setText("1.5"); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setText("text"); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setInputValidator(".*"); editBox->setText("+25"); @@ -255,19 +255,19 @@ TEST_CASE("[EditBox]") { REQUIRE(editBox->setInputValidator(tgui::EditBox::Validator::UInt)); REQUIRE(editBox->getInputValidator() == tgui::EditBox::Validator::UInt); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setText("-5"); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setText("642"); REQUIRE(editBox->getText() == "642"); editBox->setText("1.5"); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setText("text"); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setInputValidator(".*"); editBox->setText("10"); @@ -287,7 +287,7 @@ TEST_CASE("[EditBox]") editBox->setText(""); editBox->textEntered('-'); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); } } @@ -295,7 +295,7 @@ TEST_CASE("[EditBox]") { REQUIRE(editBox->setInputValidator(tgui::EditBox::Validator::Float)); REQUIRE(editBox->getInputValidator() == tgui::EditBox::Validator::Float); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setText("-5"); REQUIRE(editBox->getText() == "-5"); @@ -313,7 +313,7 @@ TEST_CASE("[EditBox]") REQUIRE(editBox->getText() == ".001"); editBox->setText("text"); - REQUIRE(editBox->getText() == ""); + REQUIRE(editBox->getText().empty()); editBox->setInputValidator(".*"); editBox->setText("-2.5"); @@ -777,7 +777,7 @@ TEST_CASE("[EditBox]") SECTION("Selected text") { editBox->setText("Hello"); - REQUIRE(editBox->getSelectedText() == ""); + REQUIRE(editBox->getSelectedText().empty()); editBox->selectText(1, 3); REQUIRE(editBox->getSelectedText() == "ell"); @@ -786,7 +786,7 @@ TEST_CASE("[EditBox]") REQUIRE(editBox->getSelectedText() == "lo"); editBox->selectText(2, 0); - REQUIRE(editBox->getSelectedText() == ""); + REQUIRE(editBox->getSelectedText().empty()); editBox->selectText(); REQUIRE(editBox->getSelectedText() == "Hello"); @@ -853,12 +853,12 @@ TEST_CASE("[EditBox]") REQUIRE(editBox->getSelectedText() == "Test"); editBox->setText("Test"); - REQUIRE(editBox->getSelectedText() == ""); + REQUIRE(editBox->getSelectedText().empty()); // ctrl+alt+A must not function as ctrl+A event.alt = true; editBox->keyPressed(event); - REQUIRE(editBox->getSelectedText() == ""); + REQUIRE(editBox->getSelectedText().empty()); } } } diff --git a/tests/Widgets/FileDialog.cpp b/tests/Widgets/FileDialog.cpp index 5a0d0ae3e..b0a2b187a 100644 --- a/tests/Widgets/FileDialog.cpp +++ b/tests/Widgets/FileDialog.cpp @@ -63,7 +63,7 @@ TEST_CASE("[FileDialog]") SECTION("Filename") { - REQUIRE(dialog->getFilename() == ""); + REQUIRE(dialog->getFilename().empty()); dialog->setFilename("Config.txt"); REQUIRE(dialog->getFilename() == "Config.txt"); } diff --git a/tests/Widgets/Label.cpp b/tests/Widgets/Label.cpp index 88740ad59..dd5d00ae3 100644 --- a/tests/Widgets/Label.cpp +++ b/tests/Widgets/Label.cpp @@ -56,7 +56,7 @@ TEST_CASE("[Label]") SECTION("Text") { - REQUIRE(label->getText() == ""); + REQUIRE(label->getText().empty()); label->setText("SomeText"); REQUIRE(label->getText() == "SomeText"); } diff --git a/tests/Widgets/ListBox.cpp b/tests/Widgets/ListBox.cpp index b47529bcd..6a775878f 100644 --- a/tests/Widgets/ListBox.cpp +++ b/tests/Widgets/ListBox.cpp @@ -93,13 +93,13 @@ TEST_CASE("[ListBox]") REQUIRE(listBox->getItemById("1") == "Item 1"); REQUIRE(listBox->getItemById("2") == "Item 2"); - REQUIRE(listBox->getItemById("3") == ""); + REQUIRE(listBox->getItemById("3").empty()); listBox->addMultipleItems({"Item 4", "Item 5", "Item 6", "Item 7"}); REQUIRE(listBox->getItemCount() == 7); REQUIRE(listBox->getItems()[3] == "Item 4"); REQUIRE(listBox->getItems()[6] == "Item 7"); - REQUIRE(listBox->getIdByIndex(6) == ""); + REQUIRE(listBox->getIdByIndex(6).empty()); listBox->addMultipleItems({}); REQUIRE(listBox->getItemCount() == 7); @@ -113,16 +113,16 @@ TEST_CASE("[ListBox]") REQUIRE(listBox->getItems()[0] == "Item 1"); REQUIRE(listBox->getItemById("1") == "Item 1"); - REQUIRE(listBox->getItemById("3") == ""); + REQUIRE(listBox->getItemById("3").empty()); REQUIRE(listBox->getItemByIndex(1) == "Item 2"); - REQUIRE(listBox->getItemByIndex(2) == ""); + REQUIRE(listBox->getItemByIndex(2).empty()); REQUIRE(listBox->getIndexById("1") == 0); REQUIRE(listBox->getIndexById("3") == -1); REQUIRE(listBox->getIdByIndex(1) == "2"); - REQUIRE(listBox->getIdByIndex(2) == ""); + REQUIRE(listBox->getIdByIndex(2).empty()); } SECTION("Removing items") @@ -210,8 +210,8 @@ TEST_CASE("[ListBox]") listBox->addItem("Item 2", "2"); listBox->addItem("Item 3", "3"); - REQUIRE(listBox->getSelectedItem() == ""); - REQUIRE(listBox->getSelectedItemId() == ""); + REQUIRE(listBox->getSelectedItem().empty()); + REQUIRE(listBox->getSelectedItemId().empty()); REQUIRE(listBox->getSelectedItemIndex() == -1); REQUIRE(!listBox->setSelectedItem("Item 0")); @@ -236,8 +236,8 @@ TEST_CASE("[ListBox]") REQUIRE(listBox->getSelectedItemIndex() == 2); listBox->deselectItem(); - REQUIRE(listBox->getSelectedItem() == ""); - REQUIRE(listBox->getSelectedItemId() == ""); + REQUIRE(listBox->getSelectedItem().empty()); + REQUIRE(listBox->getSelectedItemId().empty()); REQUIRE(listBox->getSelectedItemIndex() == -1); } diff --git a/tests/Widgets/ListView.cpp b/tests/Widgets/ListView.cpp index 03309455a..00de89b65 100644 --- a/tests/Widgets/ListView.cpp +++ b/tests/Widgets/ListView.cpp @@ -283,18 +283,18 @@ TEST_CASE("[ListView]") listView->addItem({ "2,1", "2,2" }); REQUIRE(listView->getItemCell(0, 0) == "1,1"); - REQUIRE(listView->getItemCell(0, 1) == ""); + REQUIRE(listView->getItemCell(0, 1).empty()); REQUIRE(listView->getItemRows() == std::vector>{ {"1,1"}, { "2,1" }}); listView->addColumn("Col 1"); REQUIRE(listView->getItemCell(1, 0) == "2,1"); - REQUIRE(listView->getItemCell(0, 1) == ""); - REQUIRE(listView->getItemCell(2, 1) == ""); + REQUIRE(listView->getItemCell(0, 1).empty()); + REQUIRE(listView->getItemCell(2, 1).empty()); REQUIRE(listView->getItemRows() == std::vector>{ {"1,1"}, { "2,1" }}); listView->addColumn("Col 2"); REQUIRE(listView->getItemCell(1, 1) == "2,2"); - REQUIRE(listView->getItemCell(0, 2) == ""); + REQUIRE(listView->getItemCell(0, 2).empty()); REQUIRE(listView->getItemRows() == std::vector>{ {"1,1", "1,2"}, { "2,1", "2,2" }}); } @@ -313,7 +313,7 @@ TEST_CASE("[ListView]") REQUIRE(listView->getSelectedItemIndex() == -1); listView->setMultiSelect(true); - REQUIRE(listView->getSelectedItemIndices() == std::set{ }); + REQUIRE(listView->getSelectedItemIndices().empty()); listView->setSelectedItems({ 0, 2 }); REQUIRE(listView->getSelectedItemIndices() == std::set{ 0, 2 }); @@ -322,7 +322,7 @@ TEST_CASE("[ListView]") listView->setSelectedItems({ 1, 2 }); REQUIRE(listView->getSelectedItemIndices() == std::set{ 1 }); listView->deselectItems(); - REQUIRE(listView->getSelectedItemIndices() == std::set{ }); + REQUIRE(listView->getSelectedItemIndices().empty()); } SECTION("Header height") diff --git a/tests/Widgets/MenuBar.cpp b/tests/Widgets/MenuBar.cpp index d6b5ec382..db3477a0c 100644 --- a/tests/Widgets/MenuBar.cpp +++ b/tests/Widgets/MenuBar.cpp @@ -162,7 +162,7 @@ TEST_CASE("[MenuBar]") REQUIRE(menuBar->getMenus()[1].menuItems[0].text == "Redo"); REQUIRE(menuBar->getMenus()[1].menuItems[1].text == "Copy"); REQUIRE(menuBar->getMenus()[2].text == "Help"); - REQUIRE(menuBar->getMenus()[2].menuItems.size() == 0); + REQUIRE(menuBar->getMenus()[2].menuItems.empty()); } SECTION("Removing menu") diff --git a/tests/Widgets/MessageBox.cpp b/tests/Widgets/MessageBox.cpp index 8f25fddaa..b318080f8 100644 --- a/tests/Widgets/MessageBox.cpp +++ b/tests/Widgets/MessageBox.cpp @@ -44,7 +44,7 @@ TEST_CASE("[MessageBox]") SECTION("Text") { - REQUIRE(messageBox->getText() == ""); + REQUIRE(messageBox->getText().empty()); messageBox->setText("Some text"); REQUIRE(messageBox->getText() == "Some text"); } @@ -57,7 +57,7 @@ TEST_CASE("[MessageBox]") SECTION("Buttons") { - REQUIRE(messageBox->getButtons().size() == 0); + REQUIRE(messageBox->getButtons().empty()); messageBox->addButton("First"); REQUIRE(messageBox->getButtons().size() == 1); @@ -71,11 +71,11 @@ TEST_CASE("[MessageBox]") SECTION("ChangeButtons") { - REQUIRE(messageBox->getButtons().size() == 0); + REQUIRE(messageBox->getButtons().empty()); // Empty captions on empty MessageBox does nothing. messageBox->changeButtons({}); - REQUIRE(messageBox->getButtons().size() == 0); + REQUIRE(messageBox->getButtons().empty()); // Adding a single caption from empty. messageBox->changeButtons({ "First" }); @@ -84,7 +84,7 @@ TEST_CASE("[MessageBox]") // Empty captions on MessageBox removes single buttons. messageBox->changeButtons({}); - REQUIRE(messageBox->getButtons().size() == 0); + REQUIRE(messageBox->getButtons().empty()); // Adding a multiple captions from empty. messageBox->changeButtons({ "First", "Second", "Third" }); @@ -95,7 +95,7 @@ TEST_CASE("[MessageBox]") // Empty captions on MessageBox also removes mutliple buttons. messageBox->changeButtons({}); - REQUIRE(messageBox->getButtons().size() == 0); + REQUIRE(messageBox->getButtons().empty()); // Changing with a single caption will rename existing button. messageBox->addButton("First"); diff --git a/tests/Widgets/PanelListBox.cpp b/tests/Widgets/PanelListBox.cpp index 2b76ca3c2..0b680ca70 100644 --- a/tests/Widgets/PanelListBox.cpp +++ b/tests/Widgets/PanelListBox.cpp @@ -102,7 +102,7 @@ TEST_CASE("[PanelListBox]") REQUIRE(panelListBox->getIndexById("3") == -1); REQUIRE(panelListBox->getIdByIndex(1) == "2"); - REQUIRE(panelListBox->getIdByIndex(2) == ""); + REQUIRE(panelListBox->getIdByIndex(2).empty()); } SECTION("Removing items") @@ -169,7 +169,7 @@ TEST_CASE("[PanelListBox]") const auto item3 = panelListBox->addItem("3"); REQUIRE(panelListBox->getSelectedItem() == nullptr); - REQUIRE(panelListBox->getSelectedItemId() == ""); + REQUIRE(panelListBox->getSelectedItemId().empty()); REQUIRE(panelListBox->getSelectedItemIndex() == -1); REQUIRE(!panelListBox->setSelectedItem(item0)); @@ -195,7 +195,7 @@ TEST_CASE("[PanelListBox]") panelListBox->deselectItem(); REQUIRE(panelListBox->getSelectedItem() == nullptr); - REQUIRE(panelListBox->getSelectedItemId() == ""); + REQUIRE(panelListBox->getSelectedItemId().empty()); REQUIRE(panelListBox->getSelectedItemIndex() == -1); } diff --git a/tests/Widgets/Picture.cpp b/tests/Widgets/Picture.cpp index ef61de578..0310dc88d 100644 --- a/tests/Widgets/Picture.cpp +++ b/tests/Widgets/Picture.cpp @@ -75,7 +75,7 @@ TEST_CASE("[Picture]") tguiTexture.loadFromPixelData(sfTexture.getSize(), sfTexture.copyToImage().getPixelsPtr()); REQUIRE_NOTHROW(picture = tgui::Picture::create(tguiTexture)); - REQUIRE(picture->getRenderer()->getTexture().getId() == ""); + REQUIRE(picture->getRenderer()->getTexture().getId().empty()); } } #endif diff --git a/tests/Widgets/ProgressBar.cpp b/tests/Widgets/ProgressBar.cpp index e9264c06e..f46d9e2d1 100644 --- a/tests/Widgets/ProgressBar.cpp +++ b/tests/Widgets/ProgressBar.cpp @@ -128,7 +128,7 @@ TEST_CASE("[ProgressBar]") SECTION("Text") { - REQUIRE(progressBar->getText() == ""); + REQUIRE(progressBar->getText().empty()); progressBar->setText("SomeText"); REQUIRE(progressBar->getText() == "SomeText"); } diff --git a/tests/Widgets/RadioButton.cpp b/tests/Widgets/RadioButton.cpp index 934985217..4ce57d694 100644 --- a/tests/Widgets/RadioButton.cpp +++ b/tests/Widgets/RadioButton.cpp @@ -112,7 +112,7 @@ TEST_CASE("[RadioButton]") SECTION("Text") { - REQUIRE(radioButton->getText() == ""); + REQUIRE(radioButton->getText().empty()); radioButton->setText("SomeText"); REQUIRE(radioButton->getText() == "SomeText"); } diff --git a/tests/Widgets/RichTextLabel.cpp b/tests/Widgets/RichTextLabel.cpp index a8d9f959b..dcab458b5 100644 --- a/tests/Widgets/RichTextLabel.cpp +++ b/tests/Widgets/RichTextLabel.cpp @@ -56,7 +56,7 @@ TEST_CASE("[RichTextLabel]") SECTION("Text") { - REQUIRE(label->getText() == ""); + REQUIRE(label->getText().empty()); label->setText("SomeText"); REQUIRE(label->getText() == "SomeText"); } diff --git a/tests/Widgets/Tabs.cpp b/tests/Widgets/Tabs.cpp index 003ce2f82..0dbf269cc 100644 --- a/tests/Widgets/Tabs.cpp +++ b/tests/Widgets/Tabs.cpp @@ -130,7 +130,7 @@ TEST_CASE("[Tabs]") SECTION("Selecting items") { tabs->add("Item 1", false); - REQUIRE(tabs->getSelected() == ""); + REQUIRE(tabs->getSelected().empty()); REQUIRE(tabs->getSelectedIndex() == -1); tabs->add("Item 2", true); @@ -146,7 +146,7 @@ TEST_CASE("[Tabs]") REQUIRE(tabs->getSelectedIndex() == 3); REQUIRE(!tabs->select("Item 0")); - REQUIRE(tabs->getSelected() == ""); + REQUIRE(tabs->getSelected().empty()); REQUIRE(tabs->getSelectedIndex() == -1); REQUIRE(tabs->select("Item 1")); @@ -154,7 +154,7 @@ TEST_CASE("[Tabs]") REQUIRE(tabs->getSelectedIndex() == 0); REQUIRE(!tabs->select(4)); - REQUIRE(tabs->getSelected() == ""); + REQUIRE(tabs->getSelected().empty()); REQUIRE(tabs->getSelectedIndex() == -1); REQUIRE(tabs->select(2)); @@ -162,7 +162,7 @@ TEST_CASE("[Tabs]") REQUIRE(tabs->getSelectedIndex() == 2); tabs->deselect(); - REQUIRE(tabs->getSelected() == ""); + REQUIRE(tabs->getSelected().empty()); REQUIRE(tabs->getSelectedIndex() == -1); } diff --git a/tests/Widgets/TextArea.cpp b/tests/Widgets/TextArea.cpp index fbab1a22f..56618b188 100644 --- a/tests/Widgets/TextArea.cpp +++ b/tests/Widgets/TextArea.cpp @@ -78,7 +78,7 @@ TEST_CASE("[TextArea]") SECTION("Text") { - REQUIRE(textArea->getText() == ""); + REQUIRE(textArea->getText().empty()); textArea->setText("Hello"); REQUIRE(textArea->getText() == "Hello"); @@ -96,7 +96,7 @@ TEST_CASE("[TextArea]") SECTION("DefaultText") { - REQUIRE(textArea->getDefaultText() == ""); + REQUIRE(textArea->getDefaultText().empty()); textArea->setDefaultText("SomeDefaultText"); REQUIRE(textArea->getDefaultText() == "SomeDefaultText"); } @@ -104,7 +104,7 @@ TEST_CASE("[TextArea]") SECTION("Selected text") { textArea->setText("SomeText"); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); REQUIRE(textArea->getSelectionStart() == textArea->getSelectionEnd()); textArea->setSelectedText(3, 6); @@ -118,7 +118,7 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getSelectionEnd() == 1); textArea->setSelectedText(2, 2); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); REQUIRE(textArea->getSelectionStart() == 2); REQUIRE(textArea->getSelectionEnd() == 2); @@ -128,7 +128,7 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getSelectionEnd() == 8); textArea->setSelectedText(10, 20); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); REQUIRE(textArea->getSelectionStart() == 8); REQUIRE(textArea->getSelectionEnd() == 8); } @@ -193,7 +193,7 @@ TEST_CASE("[TextArea]") { textArea->setReadOnly(true); textArea->textEntered('x'); - REQUIRE(textArea->getText() == ""); + REQUIRE(textArea->getText().empty()); textArea->setReadOnly(false); textArea->textEntered('x'); @@ -289,7 +289,7 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getTabString() == "\n"); textArea->setTabString("\r"); - REQUIRE(textArea->getTabString() == ""); + REQUIRE(textArea->getTabString().empty()); textArea->setTabString("a\rb\rc\u20AC\r"); REQUIRE(textArea->getTabString() == "abc\u20AC"); @@ -324,7 +324,7 @@ TEST_CASE("[TextArea]") SECTION("Selecting text") { - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); // Move the caret for (unsigned int i = 0; i < 5; ++i) @@ -336,7 +336,7 @@ TEST_CASE("[TextArea]") for (unsigned int i = 0; i < 1; ++i) textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Down, false, false)); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); // Move the caret while the shift key is pressed (text will be selected) for (unsigned int i = 0; i < 2; ++i) @@ -357,10 +357,10 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getSelectedText() == "PQRSTUVWXYZ"); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::PageUp, false, false)); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::PageDown, false, false)); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Left, false, false)); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Left, false, false)); @@ -372,10 +372,10 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getSelectedText() == "YZ"); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Home, false, false)); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::End, false, false)); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); // CTRL+A selects the whole text textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::A, true, false)); @@ -401,7 +401,7 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getSelectedText() == "LMN"); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Backspace, false, false)); REQUIRE(textArea->getText() == "ABCDEFGHIJKOPQRSTXYZ"); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Up, false, false)); for (unsigned int i = 0; i < 3; ++i) @@ -410,7 +410,7 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getSelectedText() == "BCD"); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Delete, false, false)); REQUIRE(textArea->getText() == "AEFGHIJKOPQRSTXYZ"); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Enter, false, false)); textArea->keyPressed(createKeyEvent(tgui::Event::KeyboardKey::Enter, false, false)); @@ -506,7 +506,7 @@ TEST_CASE("[TextArea]") textArea->setText(""); textArea->setFocused(true); sendTabEventToGui(gui); - REQUIRE(textArea->getText() == ""); + REQUIRE(textArea->getText().empty()); gui.setTabKeyUsageEnabled(false); textArea->setText(""); @@ -518,7 +518,7 @@ TEST_CASE("[TextArea]") textArea->setText(""); textArea->setFocused(true); sendTabEventToGui(gui); - REQUIRE(textArea->getText() == ""); + REQUIRE(textArea->getText().empty()); gui.setTabKeyUsageEnabled(false); textArea->setText(""); @@ -548,7 +548,7 @@ TEST_CASE("[TextArea]") textArea->setTabString(""); textArea->setMaximumCharacters(0); sendTabEventToGui(gui); - REQUIRE(textArea->getText() == ""); + REQUIRE(textArea->getText().empty()); } } @@ -797,12 +797,12 @@ TEST_CASE("[TextArea]") REQUIRE(textArea->getSelectedText() == "Test"); textArea->setText("Test"); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); // ctrl+alt+A must not function as ctrl+A event.alt = true; textArea->keyPressed(event); - REQUIRE(textArea->getSelectedText() == ""); + REQUIRE(textArea->getSelectedText().empty()); } } } diff --git a/tests/Widgets/ToggleButton.cpp b/tests/Widgets/ToggleButton.cpp index d27178d02..e60e7b8a5 100644 --- a/tests/Widgets/ToggleButton.cpp +++ b/tests/Widgets/ToggleButton.cpp @@ -56,7 +56,7 @@ TEST_CASE("[ToggleButton]") SECTION("Text") { - REQUIRE(button->getText() == ""); + REQUIRE(button->getText().empty()); button->setText("SomeText"); REQUIRE(button->getText() == "SomeText"); } diff --git a/tests/Widgets/TreeView.cpp b/tests/Widgets/TreeView.cpp index d11a69c17..48b073ca6 100644 --- a/tests/Widgets/TreeView.cpp +++ b/tests/Widgets/TreeView.cpp @@ -133,9 +133,9 @@ TEST_CASE("[TreeView]") REQUIRE(treeView->getNode({"Vehicles", "Whole"}).nodes[1].text == "Car"); // Testing invalid getNode calls - REQUIRE(treeView->getNode({}).text == ""); + REQUIRE(treeView->getNode({}).text.empty()); REQUIRE(treeView->getNode({}).nodes.empty()); - REQUIRE(treeView->getNode({"Vehicles", "Train"}).text == ""); + REQUIRE(treeView->getNode({"Vehicles", "Train"}).text.empty()); REQUIRE(treeView->getNode({"Vehicles", "Train"}).nodes.empty()); } @@ -181,7 +181,7 @@ TEST_CASE("[TreeView]") { treeView->removeItem({"Vehicles", "Whole", "Truck"}, false); REQUIRE(treeView->getNodes()[1].nodes[0].text == "Whole"); - REQUIRE(treeView->getNodes()[1].nodes[0].nodes.size() == 0); + REQUIRE(treeView->getNodes()[1].nodes[0].nodes.empty()); } }