Skip to content

Commit 599e38f

Browse files
committed
Add High DPI performance test for reproducing #83
1 parent aba8fdc commit 599e38f

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

qwt/tests/test_highdpi.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Licensed under the terms of the PyQwt License
4+
# Copyright (C) 2003-2009 Gerard Vermeulen, for the original PyQwt example
5+
# Copyright (c) 2015 Pierre Raybaut, for the PyQt5/PySide port and further
6+
# developments (e.g. ported to PythonQwt API)
7+
# (see LICENSE file for more details)
8+
9+
SHOW = True # Show test in GUI-based test launcher
10+
11+
import os
12+
13+
import pytest
14+
15+
from qwt.tests import utils
16+
from qwt.tests.test_simple import SimplePlot
17+
18+
# Performance should be the same with "1" and "2" scale factors:
19+
# (as of today, this is not the case, but it has to be fixed in the future:
20+
# https://github.com/PlotPyStack/PythonQwt/issues/83)
21+
os.environ["QT_SCALE_FACTOR"] = "2"
22+
23+
24+
class HighDPIPlot(SimplePlot):
25+
NUM_POINTS = 5000000 # 5 million points needed to test high DPI support
26+
27+
28+
@pytest.mark.skip(reason="This test is not relevant for the automated test suite")
29+
def test_highdpi():
30+
"""Test high DPI support"""
31+
utils.test_widget(HighDPIPlot, (800, 480))
32+
33+
34+
if __name__ == "__main__":
35+
test_highdpi()

qwt/tests/test_simple.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121

2222
class SimplePlot(qwt.QwtPlot):
23+
NUM_POINTS = 100
2324
TEST_EXPORT = True
2425

2526
def __init__(self):
@@ -30,13 +31,11 @@ def __init__(self):
3031
self.setAxisTitle(qwt.QwtPlot.yLeft, "Y-axis")
3132
self.enableAxis(self.xBottom)
3233
self.setCanvasBackground(Qt.white)
33-
canvas = self.canvas()
34-
canvas.setBorderRadius(50)
3534

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

3837
# insert a few curves
39-
x = np.arange(0.0, 10.0, 0.1)
38+
x = np.linspace(0.0, 10.0, self.NUM_POINTS)
4039
qwt.QwtPlotCurve.make(x, np.sin(x), "y = sin(x)", self, linecolor="red")
4140
qwt.QwtPlotCurve.make(x, np.cos(x), "y = cos(x)", self, linecolor="blue")
4241

0 commit comments

Comments
 (0)