Browse Source

tests: Test gears.geometry.rectangle.are_equal.

Emmanuel Lepage Vallee 4 months ago
parent
commit
8ffafe4690
1 changed files with 24 additions and 0 deletions
  1. 24
    0
      spec/gears/geometry_spec.lua

+ 24
- 0
spec/gears/geometry_spec.lua View File

@@ -121,6 +121,30 @@ describe("gears.geometry", function()
121 121
         end)
122 122
     end)
123 123
 
124
+    describe("rectangle.are_equal", function()
125
+
126
+        it("with equality", function()
127
+            assert.are_equal(true, geo.rectangle.are_equal(
128
+                {x=0, y=0, width=10, height=10},
129
+                {x=0, y=0, width=10, height=10}
130
+            ))
131
+        end)
132
+
133
+        it("without equality", function()
134
+            assert.are_equal(false, geo.rectangle.are_equal(
135
+                {x=0, y=0, width=1, height=1},
136
+                {x=2, y=2, width=1, height=1}
137
+            ))
138
+        end)
139
+
140
+        it("with intersection", function()
141
+            assert.are_equal(false, geo.rectangle.are_equal(
142
+                {x=0, y=0, width=1, height=1},
143
+                {x=0, y=0, width=2, height=2}
144
+            ))
145
+        end)
146
+    end)
147
+
124 148
     describe("rectangle.area_remove", function()
125 149
         -- TODO perhaps it would be better to compare against a cairo.region
126 150
         -- than to have this overly specific tests?

Loading…
Cancel
Save