diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
| commit | 7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch) | |
| tree | 27fb39be241fdb5ac2734c574de678977d1856d0 /libs/uibase/tests/test_formatters.cpp | |
Fluorine Manager: full Linux port of Mod Organizer 2
Complete native Linux port with FUSE-based virtual filesystem,
Proton/umu-run integration, and Flatpak packaging.
Key features:
- FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak)
- Proton/GE-Proton/umu-run launcher with env var forwarding
- Flatpak support (sandbox-aware VFS, NXM handler, umu-run)
- Wine prefix management UI
- Case-insensitive path resolution for Linux filesystems
- QSettings-safe INI handling (avoids Bethesda INI corruption)
- Portable instance support with auto-generated launcher scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/uibase/tests/test_formatters.cpp')
| -rw-r--r-- | libs/uibase/tests/test_formatters.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libs/uibase/tests/test_formatters.cpp b/libs/uibase/tests/test_formatters.cpp new file mode 100644 index 0000000..4093112 --- /dev/null +++ b/libs/uibase/tests/test_formatters.cpp @@ -0,0 +1,48 @@ +#pragma warning(push) +#pragma warning(disable : 4668) +#include <gtest/gtest.h> +#pragma warning(pop) + +#include <QString> +#include <vector> + +#include <uibase/formatters.h> + +#include <format> + +TEST(FormatterTest, Enum) +{ + enum class E + { + a = 1, + b = 2 + }; + ASSERT_EQ("1", std::format("{}", E::a)); + ASSERT_EQ("2", std::format("{}", E::b)); +} + +// simply test that we can format between string types +TEST(FormatterTest, String) +{ + using namespace std::string_literals; + ASSERT_EQ("Hello World!", std::format("{}", L"Hello World!"s)); + ASSERT_EQ("Hello World!", std::format("{}", QString("Hello World!"))); + ASSERT_EQ(L"Hello World!", std::format(L"{}", QString("Hello World!"))); +} + +TEST(FormatterTest, RandomAccessContainer) +{ + // note: this is standard since C++23, so this does not test much, and unfortunately + // there is no way to customize the output format of the random access container + ASSERT_EQ("[]", std::format("{}", std::vector<int>{})); + ASSERT_EQ("[1, 2, 3]", std::format("{}", std::vector{1, 2, 3})); + ASSERT_EQ("[1, 2, 3, 4, 5, 6, 7]", + std::format("{}", std::vector{1, 2, 3, 4, 5, 6, 7})); + + ASSERT_EQ("[\"AL\", \"Holt59\", \"Silarn\"]", + std::format("{}", QStringList{"AL", "Holt59", "Silarn"})); + + ASSERT_EQ("[QVariant(type=QString, value=MO2), QVariant(type=bool, value=true), " + "QVariant(type=int, value=45)]", + std::format("{}", QVariantList{"MO2", true, 45})); +} |
