Skip to content

Commit

Permalink
Add High DPI performance test for reproducing #83
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed May 2, 2024
1 parent aba8fdc commit 599e38f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
35 changes: 35 additions & 0 deletions qwt/tests/test_highdpi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the PyQwt License
# Copyright (C) 2003-2009 Gerard Vermeulen, for the original PyQwt example
# Copyright (c) 2015 Pierre Raybaut, for the PyQt5/PySide port and further
# developments (e.g. ported to PythonQwt API)
# (see LICENSE file for more details)

SHOW = True # Show test in GUI-based test launcher

import os

import pytest

from qwt.tests import utils
from qwt.tests.test_simple import SimplePlot

# Performance should be the same with "1" and "2" scale factors:
# (as of today, this is not the case, but it has to be fixed in the future:
# https://github.com/PlotPyStack/PythonQwt/issues/83)
os.environ["QT_SCALE_FACTOR"] = "2"


class HighDPIPlot(SimplePlot):
NUM_POINTS = 5000000 # 5 million points needed to test high DPI support


@pytest.mark.skip(reason="This test is not relevant for the automated test suite")
def test_highdpi():
"""Test high DPI support"""
utils.test_widget(HighDPIPlot, (800, 480))


if __name__ == "__main__":
test_highdpi()
5 changes: 2 additions & 3 deletions qwt/tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


class SimplePlot(qwt.QwtPlot):
NUM_POINTS = 100
TEST_EXPORT = True

def __init__(self):
Expand All @@ -30,13 +31,11 @@ def __init__(self):
self.setAxisTitle(qwt.QwtPlot.yLeft, "Y-axis")
self.enableAxis(self.xBottom)
self.setCanvasBackground(Qt.white)
canvas = self.canvas()
canvas.setBorderRadius(50)

qwt.QwtPlotGrid.make(self, color=Qt.lightGray, width=0, style=Qt.DotLine)

# insert a few curves
x = np.arange(0.0, 10.0, 0.1)
x = np.linspace(0.0, 10.0, self.NUM_POINTS)
qwt.QwtPlotCurve.make(x, np.sin(x), "y = sin(x)", self, linecolor="red")
qwt.QwtPlotCurve.make(x, np.cos(x), "y = cos(x)", self, linecolor="blue")

Expand Down

0 comments on commit 599e38f

Please sign in to comment.