Browse Source

floor joint pos

ell 1 year ago
parent
commit
37961f92d6
2 changed files with 14 additions and 13 deletions
  1. 10 9
      testing/tests/graphics.lua
  2. 4 4
      testing/tests/physics.lua

+ 10 - 9
testing/tests/graphics.lua

@@ -1508,16 +1508,16 @@ love.test.graphics.setBlendMode = function(test)
     love.graphics.clear(0.5, 0.5, 0.5, 1)
     love.graphics.setBlendMode('add', 'alphamultiply')
     love.graphics.setColor(1, 0, 0, 1)
-    love.graphics.points({1,1})
+    love.graphics.rectangle('fill', 0, 0, 1, 1)
     love.graphics.setBlendMode('subtract', 'alphamultiply')
     love.graphics.setColor(1, 1, 1, 0.5)
-    love.graphics.points({16,1})
+    love.graphics.rectangle('fill', 15, 0, 1, 1)
     love.graphics.setBlendMode('multiply', 'premultiplied')
     love.graphics.setColor(0, 1, 0, 1)
-    love.graphics.points({16,16})
+    love.graphics.rectangle('fill', 15, 15, 1, 1)
     love.graphics.setBlendMode('replace', 'premultiplied')
     love.graphics.setColor(0, 0, 1, 0.5)
-    love.graphics.points({1,16})
+    love.graphics.rectangle('fill', 0, 15, 1, 1)
     love.graphics.setColor(1, 1, 1, 1)
   love.graphics.setCanvas()
   local imgdata = love.graphics.readbackTexture(canvas, {16, 0, 0, 0, 16, 16})
@@ -1568,13 +1568,14 @@ love.test.graphics.setColor = function(test)
     test:assertEquals(0, g, 'check g set')
     test:assertEquals(0, b, 'check b set')
     test:assertEquals(1, a, 'check a set')
-    love.graphics.points({{1,1},{6,1},{11,1},{16,1}})
+
+    love.graphics.rectangle('fill', 0, 0, 16, 1)
     love.graphics.setColor(1, 1, 0, 1)
-    love.graphics.points({{1,2},{6,2},{11,2},{16,2}})
+    love.graphics.rectangle('fill', 0, 1, 16, 1)
     love.graphics.setColor(0, 1, 0, 0.5)
-    love.graphics.points({{1,3},{6,3},{11,3},{16,3}})
+    love.graphics.rectangle('fill', 0, 2, 16, 1)
     love.graphics.setColor(0, 0, 1, 1)
-    love.graphics.points({{1,4},{6,4},{11,4},{16,4}})
+    love.graphics.rectangle('fill', 0, 3, 16, 1)
     love.graphics.setColor(1, 1, 1, 1)
   love.graphics.setCanvas()
   local imgdata = love.graphics.readbackTexture(canvas, {16, 0, 0, 0, 16, 16})
@@ -1878,8 +1879,8 @@ love.test.graphics.setWireframe = function(test)
       love.graphics.setColor(1, 1, 0, 1)
       love.graphics.rectangle('fill', 2, 2, 13, 13)
       love.graphics.setColor(1, 1, 1, 1)
-      love.graphics.setWireframe(false)
     love.graphics.setCanvas()
+    love.graphics.setWireframe(false)
     local imgdata = love.graphics.readbackTexture(canvas, {16, 0, 0, 0, 16, 16})
     test:assertPixels(imgdata, { 
       yellow = {{1,14},{14,1},{14,14},{2,2},{13,13}},

+ 4 - 4
testing/tests/physics.lua

@@ -37,10 +37,10 @@ love.test.physics.Joint = function(test)
   test:assertEquals(body1:getX(), b1:getX(), 'check body 1')
   test:assertEquals(body2:getX(), b2:getX(), 'check body 2')
   local x1, y1, x2, y2 = joint:getAnchors()
-  test:assertEquals(10, x1, 'check anchor x1')
-  test:assertEquals(10, y1, 'check anchor y1')
-  test:assertEquals(20, x2, 'check anchor x2')
-  test:assertEquals(20, y2, 'check anchor y2')
+  test:assertEquals(10, math.floor(x1), 'check anchor x1')
+  test:assertEquals(10, math.floor(y1), 'check anchor y1')
+  test:assertEquals(20, math.floor(x2), 'check anchor x2')
+  test:assertEquals(20, math.floor(y2), 'check anchor y2')
   test:assertEquals(true, joint:getCollideConnected(), 'check not colliding')
   -- test userdata
   test:assertEquals(nil, joint:getUserData(), 'check no data by def')