Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.

Commit 91a09d1

Browse files
committed
Added two more tests
1 parent 44793ef commit 91a09d1

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: ~> 1.0
21
language: python
32
jobs:
43
allow_failures:

tests/test_button.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from modules.gui import Graph, QtWidgets, QtGui
33
from modules.geometry import dist, Point
44
from modules import configureImage
5-
from PySide2.QtCore import Qt
5+
from PySide2.QtCore import Qt, QPoint
66
from os import path
77

88
app = QtWidgets.QApplication()
@@ -81,3 +81,31 @@ def test_intInput(qtbot):
8181
for i in window.points:
8282
assert 'A' not in i[0].text(), str
8383
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'

tests/test_misc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytestqt
2-
from modules.gui import QtGui
3-
from modules.gui import Graph, QtWidgets
2+
from modules.gui import QtGui, Graph, QtWidgets
43
from PySide2.QtCore import Qt
54
from os import path
65

0 commit comments

Comments
 (0)