commit 7bb14ffb6d8f8e175c14e28ae23270051f9e1a8a
Author: jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Mon Sep 7 08:00:52 2020 -0600
Commit: jtothebell <j.to.the.bell@gmail.com>
CommitDate: Tue Sep 15 17:09:08 2020 -0600
Add tests to make sure clip sets memory values
---
test/graphicstests.cpp | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/test/graphicstests.cpp b/test/graphicstests.cpp
index 58966a8..2fcf35b 100644
--- a/test/graphicstests.cpp
+++ b/test/graphicstests.cpp
@@ -1160,6 +1160,29 @@ TEST_CASE("graphics class behaves as expected") {
checkPoints(graphics, expectedPoints);
}
+ SUBCASE("clip() resets clip memory to entire screen")
+ {
+ picoRam._gfxState_clip_xb = 28;
+ picoRam._gfxState_clip_xe = 28;
+ picoRam._gfxState_clip_yb = 50;
+ picoRam._gfxState_clip_ye = 50;
+
+ graphics->clip();
+
+ CHECK_EQ(picoRam._gfxState_clip_xb, 0);
+ CHECK_EQ(picoRam._gfxState_clip_xe, 127);
+ CHECK_EQ(picoRam._gfxState_clip_yb, 0);
+ CHECK_EQ(picoRam._gfxState_clip_ye, 127);
+ }
+ SUBCASE("clip({x}, {y}, {w}, {h}) sets clip in memory")
+ {
+ graphics->clip(50, 75, 25, 25);
+
+ CHECK_EQ(picoRam._gfxState_clip_xb, 50);
+ CHECK_EQ(picoRam._gfxState_clip_xe, 75);
+ CHECK_EQ(picoRam._gfxState_clip_yb, 75);
+ CHECK_EQ(picoRam._gfxState_clip_ye, 100);
+ }