Files
anki/qt/tests/test_package.py
Abdo 88ef75f363 fix: Limit taskbar pinning fix to launcher builds (#4849)
This just limits the fix added in
469fd763c7
to the launcher so it has no effect on Briefcase builds. It looks
harmless, but just in case it does cause subtle issues.

---------

Co-authored-by: Fernando Lins <1887601+fernandolins@users.noreply.github.com>
2026-05-26 13:22:18 +03:00

28 lines
838 B
Python

# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import os
import sys
import pytest
@pytest.mark.skipif(sys.platform != "win32", reason="windows taskbar test")
@pytest.mark.parametrize("is_launcher", [False, True])
def test_app_user_model_id_set(monkeypatch, is_launcher: bool) -> None:
from pywintypes import com_error
from win32com.shell import shell
from aqt.package import _fix_win_taskbar_pinning
if is_launcher:
monkeypatch.setenv("ANKI_LAUNCHER", "testpath")
_fix_win_taskbar_pinning()
assert shell.GetCurrentProcessExplicitAppUserModelID() == "Ankitects.Anki"
else:
_fix_win_taskbar_pinning()
with pytest.raises(com_error):
shell.GetCurrentProcessExplicitAppUserModelID()