Browse Source

tests: draw points at the center instead of corner of pixels.

Sasha Szpakowski 1 year ago
parent
commit
57fab45c2c
2 changed files with 6 additions and 10 deletions
  1. 0 1
      testing/readme.md
  2. 6 9
      testing/tests/graphics.lua

+ 0 - 1
testing/readme.md

@@ -144,7 +144,6 @@ You can specify the test suite is being run on a runner by adding the `--isRunne
 `& 'c:\Program Files\LOVE\love.exe' PATH_TO_TESTING_FOLDER/main.lua --console --runAllTests --isRunner`
 | Test                       |    OS     |      Exception      | Reason |
 | -------------------------- | --------- | ------------------- | ------ |
-| love.graphics.points       |   MacOS   |    1px tolerance    | Points are offset by 1,1 when drawn |
 | love.graphics.setWireframe |   MacOS   |    1px tolerance    | Wireframes are offset by 1,1 when drawn |
 | love.graphica.arc          |   MacOS   |       Skipped       | Arc curves are drawn slightly off at really low scale  |
 | love.graphics.setLineStyle |   Linux   |   1rgba tolerance   | 'Rough' lines blend differently with the background rgba |

+ 6 - 9
testing/tests/graphics.lua

@@ -1383,19 +1383,16 @@ end
 -- love.graphics.points
 love.test.graphics.points = function(test)
   local canvas = love.graphics.newCanvas(16, 16)
-  love.graphics.setCanvas(canvas)
+  love.graphics.push("all")
+    love.graphics.setCanvas(canvas)
     love.graphics.clear(0, 0, 0, 1)
+    love.graphics.translate(0.5, 0.5) -- draw points at the center of pixels
     love.graphics.setColor(1, 0, 0, 1)
-    love.graphics.points(1,1,16,1,16,16,1,16,1,1)
+    love.graphics.points(0,0,15,0,15,15,0,15,0,0)
     love.graphics.setColor(1, 1, 0, 1)
-    love.graphics.points({2,2,8,8,15,2,8,9,15,15,9,9,2,15,9,8})
-    love.graphics.setColor(1, 1, 1, 1)
-  love.graphics.setCanvas()
+    love.graphics.points({1,1,7,7,14,1,7,8,14,14,8,8,1,14,8,7})
+  love.graphics.pop()
   local imgdata = love.graphics.readbackTexture(canvas)
-  -- on macOS runners points are drawn 1px off from the target
-  if GITHUB_RUNNER and love.system.getOS() == 'OS X' then
-    test.pixel_tolerance = 1
-  end
   test:compareImg(imgdata)
 end