diff --git a/.gitignore b/.gitignore index 3f5288d45..503612a68 100644 --- a/.gitignore +++ b/.gitignore @@ -69,7 +69,4 @@ stamp-h1 /src/tags .vs/ .vscode/ -/testing/output/*.xml -/testing/output/*.html -/testing/output/*.md -/testing/output/actual/*.png +/testing/output/ diff --git a/testing/classes/TestMethod.lua b/testing/classes/TestMethod.lua index 1f336d06b..6716abc1a 100644 --- a/testing/classes/TestMethod.lua +++ b/testing/classes/TestMethod.lua @@ -270,10 +270,15 @@ TestMethod = { -- @param {table} imgdata - imgdata to save as a png -- @return {nil} compareImg = function(self, imgdata) - local expected_path = 'tempoutput/expected/love.test.graphics.' .. - self.method .. '-' .. tostring(self.imgs) .. '.png' - local ok, chunk, _ = pcall(love.image.newImageData, expected_path) + local filename = 'love.test.graphics.' .. self.method .. '-' .. tostring(self.imgs) .. '.png' + local expected_path = 'resources/expected_output/' .. filename + local ok, chunk = pcall(love.filesystem.read, 'data', expected_path) + if ok == false then return self:assertEquals(true, false, chunk) end + local image_contents = chunk + ok, chunk = pcall(love.image.newImageData, chunk) if ok == false then return self:assertEquals(true, false, chunk) end + -- Copy the expected file output to tempoutput/expected to keep HTML output working. + love.filesystem.write('tempoutput/expected/' .. filename, image_contents) local expected = chunk local iw = imgdata:getWidth()-2 local ih = imgdata:getHeight()-2 diff --git a/testing/classes/TestSuite.lua b/testing/classes/TestSuite.lua index 8a2e76dee..4b262aa5a 100644 --- a/testing/classes/TestSuite.lua +++ b/testing/classes/TestSuite.lua @@ -164,7 +164,7 @@ TestSuite = { local status = '🔴' if self.totals[2] == 0 then status = '🟢' end - local html = '

' .. status .. ' love.test