diff --git a/src/Gui/SplashScreen.cpp b/src/Gui/SplashScreen.cpp index 7006911..d94ada2 100644 --- a/src/Gui/SplashScreen.cpp +++ b/src/Gui/SplashScreen.cpp @@ -47,6 +47,16 @@ using namespace Gui; namespace Gui { +bool shouldDrawSplashScreenTitle(const QString& title) +{ + QString compactTitle = title; + compactTitle.remove(QRegularExpression(QStringLiteral("\\s"))); + compactTitle = compactTitle.toCaseFolded(); + + return compactTitle != QLatin1String("freecad") + && compactTitle != QLatin1String("lightworks3d"); +} + /** Displays all messages at startup inside the splash screen. * \author Werner Mayer */ @@ -387,8 +397,8 @@ QPixmap SplashScreen::splashImage() if (color.isValid()) { painter.setPen(color); painter.setFont(fontExe); - if (title != QLatin1String("FreeCAD")) { - // FreeCAD's Splashscreen already contains the EXE name, no need to draw it + if (shouldDrawSplashScreenTitle(title)) { + // Some splashscreen graphics already contain the EXE name, no need to draw it. painter.drawText(x, y, title); } painter.setFont(fontVer); diff --git a/src/Gui/SplashScreen.h b/src/Gui/SplashScreen.h index 4310abe..6f6e161 100644 --- a/src/Gui/SplashScreen.h +++ b/src/Gui/SplashScreen.h @@ -23,13 +23,18 @@ #ifndef GUI_SPLASHSCREEN_H #define GUI_SPLASHSCREEN_H +#include "FCGlobal.h" + #include +#include namespace Gui { class SplashObserver; +GuiExport bool shouldDrawSplashScreenTitle(const QString& title); + /** This widget provides a splash screen that can be shown during application startup. * * \author Werner Mayer diff --git a/tests/src/Gui/CMakeLists.txt b/tests/src/Gui/CMakeLists.txt index d0ce6af..d4dd8c2 100644 --- a/tests/src/Gui/CMakeLists.txt +++ b/tests/src/Gui/CMakeLists.txt @@ -10,6 +10,7 @@ add_executable(Gui_tests_run StyleParameters/ParserTest.cpp StyleParameters/ParameterManagerTest.cpp InputHintTest.cpp + SplashScreen.cpp ) # Qt tests diff --git a/tests/src/Gui/SplashScreen.cpp b/tests/src/Gui/SplashScreen.cpp new file mode 100644 index 0000000..4ba4176 --- /dev/null +++ b/tests/src/Gui/SplashScreen.cpp @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include + +#include + +TEST(SplashScreen, doesNotDrawBundledBrandTitles) +{ + EXPECT_FALSE(Gui::shouldDrawSplashScreenTitle(QStringLiteral("FreeCAD"))); + EXPECT_FALSE(Gui::shouldDrawSplashScreenTitle(QStringLiteral("Light works 3D"))); + EXPECT_FALSE(Gui::shouldDrawSplashScreenTitle(QStringLiteral("LightWorks3D"))); + EXPECT_FALSE(Gui::shouldDrawSplashScreenTitle(QStringLiteral("lightworks3D"))); +} + +TEST(SplashScreen, drawsCustomBrandTitles) +{ + EXPECT_TRUE(Gui::shouldDrawSplashScreenTitle(QStringLiteral("CustomCAD"))); +}