diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index ba9964a..9c267f5 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -23,6 +23,8 @@ jobs: qt: "pyqt5" - os: ubuntu-24.04 qt: "pyqt6" + - os: windows-latest + qt: "pyqt6" - os: ubuntu-latest qt: "pyside6" runs-on: ${{ matrix.os }} @@ -48,7 +50,7 @@ jobs: if: matrix.qt != '' run: | set -eo pipefail - pip install ${{ matrix.qt }} matplotlib + pip install ${{ matrix.qt }} matplotlib qtpy QT_DEBUG_PLUGINS=1 LIBGL_DEBUG=verbose python tests/test_qt.py shell: bash - uses: actions/upload-artifact@v4 @@ -56,3 +58,16 @@ jobs: name: ${{ matrix.os }}-${{ matrix.qt }}-cube path: ${{ matrix.os }}-${{ matrix.qt }}-cube.png if-no-files-found: error + - name: Test Vispy Qt + if: matrix.qt != '' + run: | + pip install vispy pillow pyopengl + python tests/test_vispy_qt.py + env: + MATRIX_OS: ${{ matrix.os }} + MATRIX_QT: ${{ matrix.qt }} + - uses: actions/upload-artifact@v4 + if: matrix.qt != '' + with: + name: ${{ matrix.os }}-${{ matrix.qt }}-vispy-volume + path: ${{ matrix.os }}-${{ matrix.qt }}-vispy-volume.png diff --git a/tests/test_qt.py b/tests/test_qt.py index 1d1b6c7..a926d19 100644 --- a/tests/test_qt.py +++ b/tests/test_qt.py @@ -4,3 +4,6 @@ plt.figure() backend = matplotlib.get_backend() assert backend == 'QtAgg', backend + +from qtpy import QtDBus +_ = QtDBus.QDBusConnection('Name') diff --git a/tests/test_vispy_qt.py b/tests/test_vispy_qt.py new file mode 100644 index 0000000..7b682de --- /dev/null +++ b/tests/test_vispy_qt.py @@ -0,0 +1,21 @@ +"""Quickly check if vispy off screen plotting works.""" + +import os +from pathlib import Path +import numpy as np +from qtpy.QtWidgets import QApplication +from vispy import scene +from PIL import Image + +qapp = QApplication([]) +canvas = scene.SceneCanvas(size=(512, 512)) +view = canvas.central_widget.add_view() +np.random.seed(0) +vol_data = np.random.rand(64, 64, 64).astype(np.float32) +image = scene.visuals.Volume(vol_data, cmap="viridis", parent=view.scene) +view.camera = scene.ArcballCamera() +canvas.show() + +fname = f'{os.environ['MATRIX_OS']}-{os.environ['MATRIX_QT']}-vispy-volume.png' +out_path = Path(__file__).parent.parent / fname +Image.fromarray(canvas.render()).save(out_path)