commit 45f18e25bc6a49f693c87957298fe64479cf6fc9
Author: jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Sun Dec 27 19:31:18 2020 -0700
Commit: jtothebell <j.to.the.bell@gmail.com>
CommitDate: Sun Dec 27 19:31:18 2020 -0700
Add tests around overdraw bug
---
test/graphicstests.cpp | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/test/graphicstests.cpp b/test/graphicstests.cpp
index 01f3ec8..27e54f8 100644
--- a/test/graphicstests.cpp
+++ b/test/graphicstests.cpp
@@ -313,6 +313,31 @@ TEST_CASE("graphics class behaves as expected") {
checkPoints(graphics, expectedPoints);
}
+ SUBCASE("overdrawn line() still draws (horizontal)") {
+ graphics->cls();
+ graphics->line(-10, 1, 138, 1, 5);
+
+ std::vector<coloredPoint> expectedPoints = {
+ {0, 1, 5},
+ {1, 1, 5},
+ {2, 1, 5}//etc
+ };
+
+ checkPoints(graphics, expectedPoints);
+ }
+ SUBCASE("overdrawn line() still draws (vertical)") {
+ graphics->cls();
+ graphics->line(1, -10, 1, 138, 5);
+
+ std::vector<coloredPoint> expectedPoints = {
+ {1, 0, 5},
+ {1, 1, 5},
+ {1, 2, 5}//etc
+ };
+
+ checkPoints(graphics, expectedPoints);
+ }
+
SUBCASE("circ({ox}, {oy}) uses pen color and radius of 4") {
graphics->cls();
graphics->circ(40, 40);