Skip to content

Commit 418cad6

Browse files
committed
test: run QML tests with Python
1 parent e9684cd commit 418cad6

3 files changed

Lines changed: 47 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,22 @@ jobs:
9292
steps:
9393
- name: Checkout Repository
9494
uses: actions/checkout@v5
95-
- name: Install Qt 6.10.*
96-
uses: jurplel/install-qt-action@v4
95+
- name: Install Python 3.13
96+
uses: actions/setup-python@v6
9797
with:
98-
arch: linux_gcc_64
99-
version: 6.10.*
100-
- name: Update Packages
101-
run: sudo apt update -y && sudo apt upgrade -y
102-
- name: Install Dependencies
103-
run: sudo apt install -y qt6-base-dev
98+
python-version: "3.13"
10499
- name: Install just
105100
uses: taiki-e/install-action@just
101+
- name: Install uv
102+
uses: astral-sh/setup-uv@v7
103+
with:
104+
enable-cache: false
105+
- name: Update Packages
106+
run: sudo apt update -y
107+
- name: Install Dependencies
108+
run: sudo apt install -y libegl1
109+
- name: Initialize Project
110+
run: just init
106111
- name: Execute Qml Tests
107112
run: just test-qml
108113

Justfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,21 @@ export QT_QUICK_CONTROLS_STYLE := 'Material'
5858

5959
# Run QML tests
6060
[group('test')]
61-
@test-qml:
62-
qmltestrunner -silent -input qt/qml
61+
test-qml: build-develop
62+
#!/usr/bin/env bash
63+
uv run python -c '
64+
import sys
65+
from PySide6.QtQuickTest import QUICK_TEST_MAIN_WITH_SETUP
66+
from test.prepare_qml import MyTestSetup
67+
68+
# Pass additional arguments to qmltestrunner:
69+
sys.argv += ["-silent"]
70+
sys.argv += ["-input", "qt/qml"]
71+
# sys.argv += ["-eventdelay", "50"] # Simulate slower systems
72+
73+
ex = QUICK_TEST_MAIN_WITH_SETUP("qmltestrunner", MyTestSetup, argv=sys.argv)
74+
sys.exit(ex)
75+
'
6376

6477
@_update_pyproject_file: _generate-qrc-file
6578
uv run python build-aux/update_pyproject_file.py \

test/prepare_qml.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: mpvQC developers
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
from PySide6.QtCore import QObject, Slot
6+
from PySide6.QtQml import QQmlEngine
7+
8+
from src import startup
9+
10+
11+
# noinspection PyPep8Naming
12+
class MyTestSetup(QObject):
13+
@Slot(QQmlEngine)
14+
def qmlEngineAvailable(self, _: QQmlEngine):
15+
import rc_project # noqa: F401
16+
17+
startup.configure_qt_application_data()
18+
startup.configure_environment_variables()
19+
startup.import_bindings()

0 commit comments

Comments
 (0)