From a40adeac90e8436dc9a8ce417d4946c79837bba1 Mon Sep 17 00:00:00 2001 From: Bigsby Date: Sun, 28 Sep 2025 18:35:12 +0100 Subject: [PATCH 1/2] Add check & warning for description over 80 chars --- changes/2489.bugfix.rst | 1 + src/briefcase/platforms/windows/app.py | 17 +++++++++++++++++ .../platforms/windows/visualstudio.py | 17 +++++++++++++++++ tests/platforms/windows/app/test_build.py | 18 ++++++++++++++++++ .../windows/visualstudio/test_build.py | 18 ++++++++++++++++++ 5 files changed, 71 insertions(+) create mode 100644 changes/2489.bugfix.rst diff --git a/changes/2489.bugfix.rst b/changes/2489.bugfix.rst new file mode 100644 index 000000000..41e0eaec2 --- /dev/null +++ b/changes/2489.bugfix.rst @@ -0,0 +1 @@ +Fixed issue with app icon when building for Windows. \ No newline at end of file diff --git a/src/briefcase/platforms/windows/app.py b/src/briefcase/platforms/windows/app.py index 041909e4e..752c3cd7a 100644 --- a/src/briefcase/platforms/windows/app.py +++ b/src/briefcase/platforms/windows/app.py @@ -54,6 +54,23 @@ def verify_tools(self): with suppress(BriefcaseCommandError): WindowsSDK.verify(tools=self.tools) + def finalize_app_config(self, app: BaseConfig): + """If an app has a long description, issue a warning.""" + if len(app.description) > 80: + self.console.warning( + """\ +************************************************************************* +** WARNING: Long App description! ** +************************************************************************* + + your app has a description that is longer than 80 characters. + While this is supported, longer descriptions may be truncated + when displayed in some parts of the Windows UI. + +************************************************************************* +""" + ) + def build_app(self, app: BaseConfig, **kwargs): """Build the application. diff --git a/src/briefcase/platforms/windows/visualstudio.py b/src/briefcase/platforms/windows/visualstudio.py index 7100400be..2aecd8cb2 100644 --- a/src/briefcase/platforms/windows/visualstudio.py +++ b/src/briefcase/platforms/windows/visualstudio.py @@ -46,6 +46,23 @@ def verify_tools(self): super().verify_tools() VisualStudio.verify(tools=self.tools) + def finalize_app_config(self, app: BaseConfig): + """If an app has a long description, issue a warning.""" + if len(app.description) > 80: + self.console.warning( + """\ +************************************************************************* +** WARNING: Long App description! ** +************************************************************************* + + your app has a description that is longer than 80 characters. + While this is supported, longer descriptions may be truncated + when displayed in some parts of the Windows UI. + +************************************************************************* +""" + ) + def build_app(self, app: BaseConfig, **kwargs): """Build the Visual Studio project. diff --git a/tests/platforms/windows/app/test_build.py b/tests/platforms/windows/app/test_build.py index 2f408225e..55d8fb43a 100644 --- a/tests/platforms/windows/app/test_build.py +++ b/tests/platforms/windows/app/test_build.py @@ -94,6 +94,24 @@ def test_verify_with_windows_sdk(build_command, windows_sdk, monkeypatch): assert isinstance(build_command.tools.windows_sdk, WindowsSDK) +def test_long_description_warning(build_command, first_app_templated, capsys): + """A warning is displayed if an app has a description longer than 80 chars.""" + first_app_templated.description = "This is a very long description that exceeds the 80 character limit and it should trigger a warning." + build_command.finalize_app_config(first_app_templated) + output = capsys.readouterr().out + assert "your app has a description that is longer than 80 characters." in output + + +def test_short_description_no_warning(build_command, first_app_templated, capsys): + """No warning displayed if the app description is 80 chars or less.""" + first_app_templated.description = ( + "This is a short description that will not trigger any warnings." + ) + build_command.finalize_app_config(first_app_templated) + output = capsys.readouterr().out + assert "your app has a description that is longer than 80 characters." not in output + + @pytest.mark.skipif(sys.platform != "win32", reason="requires Windows") @pytest.mark.parametrize("pre_existing", [True, False]) @pytest.mark.parametrize("console_app", [True, False]) diff --git a/tests/platforms/windows/visualstudio/test_build.py b/tests/platforms/windows/visualstudio/test_build.py index 5d42bbce1..c18f5b4a9 100644 --- a/tests/platforms/windows/visualstudio/test_build.py +++ b/tests/platforms/windows/visualstudio/test_build.py @@ -45,6 +45,24 @@ def test_verify(build_command, monkeypatch): assert isinstance(build_command.tools.visualstudio, VisualStudio) +def test_long_description_warning(build_command, first_app_config, capsys): + """A warning is displayed if an app has a description longer than 80 chars.""" + first_app_config.description = "This is a very long description that exceeds the 80 character limit. It will trigger a warning message in the Windows Visual Studio build process. This description is definitely too long." + build_command.finalize_app_config(first_app_config) + output = capsys.readouterr().out + assert "your app has a description that is longer than 80 characters" in output + + +def test_short_description_no_warning(build_command, first_app_config, capsys): + """No warning is displayed if the app description is 80 chars or less.""" + first_app_config.description = ( + "This is a short description that will not trigger any warnings." + ) + build_command.finalize_app_config(first_app_config) + output = capsys.readouterr().out + assert "WARNING: Long App description!" not in output + + @pytest.mark.parametrize("tool_debug_mode", (True, False)) def test_build_app(build_command, first_app_config, tool_debug_mode, tmp_path): """The solution will be compiled when the project is built.""" From 57c359bf4bf14b652946daa54a3e76250351fec3 Mon Sep 17 00:00:00 2001 From: Bigsby Date: Sun, 28 Sep 2025 18:40:37 +0100 Subject: [PATCH 2/2] fix pre-commit error --- changes/2489.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/2489.bugfix.rst b/changes/2489.bugfix.rst index 41e0eaec2..d85931596 100644 --- a/changes/2489.bugfix.rst +++ b/changes/2489.bugfix.rst @@ -1 +1 @@ -Fixed issue with app icon when building for Windows. \ No newline at end of file +Fixed issue with app icon when building for Windows.