|
2 | 2 | from modules.gui import Graph, QtWidgets, QtGui |
3 | 3 | from modules.geometry import dist, Point |
4 | 4 | from modules import configureImage |
5 | | -from PySide2.QtCore import Qt |
| 5 | +from PySide2.QtCore import Qt, QPoint |
6 | 6 | from os import path |
7 | 7 |
|
8 | 8 | app = QtWidgets.QApplication() |
@@ -81,3 +81,31 @@ def test_intInput(qtbot): |
81 | 81 | for i in window.points: |
82 | 82 | assert 'A' not in i[0].text(), str |
83 | 83 | assert 'A' not in i[1].text(), str |
| 84 | + |
| 85 | +def test_bgchange(qtbot): |
| 86 | + image = configureImage(WIDTH, HEIGHT, backgroundcolour=Qt.red) |
| 87 | + gridColor = 0 |
| 88 | + bgColor = 0 |
| 89 | + for i in range(0, WIDTH): |
| 90 | + for j in range(0, HEIGHT): |
| 91 | + p = QPoint(i, j) |
| 92 | + if image.pixelColor(p) == Qt.red: |
| 93 | + bgColor += 1 |
| 94 | + else: |
| 95 | + gridColor += 1 |
| 96 | + |
| 97 | + assert (bgColor > gridColor) is True, 'Background colour of the graph is not getting changed' |
| 98 | + |
| 99 | +def test_gridchange(qtbot): |
| 100 | + image = configureImage(WIDTH, HEIGHT, gridcolour=Qt.red) |
| 101 | + gridColor = 0 |
| 102 | + bgColor = 0 |
| 103 | + for i in range(0, WIDTH): |
| 104 | + for j in range(0, HEIGHT): |
| 105 | + p = QPoint(i, j) |
| 106 | + if image.pixelColor(p) == Qt.red: |
| 107 | + bgColor += 1 |
| 108 | + else: |
| 109 | + gridColor += 1 |
| 110 | + |
| 111 | + assert (gridColor < bgColor) is True, 'Grid colour of the graph is not getting changed' |
0 commit comments