mirror of
https://github.com/love2d/love.git
synced 2026-08-12 00:20:52 +02:00
@@ -64,7 +64,7 @@ TestMethod = {
|
||||
table.insert(self.asserts, {
|
||||
key = 'assert ' .. tostring(self.count),
|
||||
passed = expected == actual,
|
||||
message = 'expected \'' .. tostring(expected) .. '\' got \'' ..
|
||||
message = 'expected \'' .. tostring(expected) .. '\' got \'' ..
|
||||
tostring(actual) .. '\'',
|
||||
test = label or 'no label given'
|
||||
})
|
||||
@@ -81,7 +81,7 @@ TestMethod = {
|
||||
table.insert(self.asserts, {
|
||||
key = 'assert ' .. tostring(self.count),
|
||||
passed = value == true,
|
||||
message = 'expected \'true\' got \'' ..
|
||||
message = 'expected \'true\' got \'' ..
|
||||
tostring(value) .. '\'',
|
||||
test = label or 'no label given'
|
||||
})
|
||||
@@ -98,7 +98,7 @@ TestMethod = {
|
||||
table.insert(self.asserts, {
|
||||
key = 'assert ' .. tostring(self.count),
|
||||
passed = value == false,
|
||||
message = 'expected \'false\' got \'' ..
|
||||
message = 'expected \'false\' got \'' ..
|
||||
tostring(value) .. '\'',
|
||||
test = label or 'no label given'
|
||||
})
|
||||
@@ -165,7 +165,7 @@ TestMethod = {
|
||||
|
||||
|
||||
-- @method - TestMethod:assertGreaterEqual()
|
||||
-- @desc - used to check a value is >= than a certain target value
|
||||
-- @desc - used to check a value is >= than a certain target value
|
||||
-- @param {any} target - value to check the test agaisnt
|
||||
-- @param {any} actual - actual value of the test
|
||||
-- @param {string} label - label for this test to use in exports
|
||||
@@ -187,7 +187,7 @@ TestMethod = {
|
||||
|
||||
|
||||
-- @method - TestMethod:assertLessEqual()
|
||||
-- @desc - used to check a value is <= than a certain target value
|
||||
-- @desc - used to check a value is <= than a certain target value
|
||||
-- @param {any} target - value to check the test agaisnt
|
||||
-- @param {any} actual - actual value of the test
|
||||
-- @param {string} label - label for this test to use in exports
|
||||
@@ -209,7 +209,7 @@ TestMethod = {
|
||||
|
||||
|
||||
-- @method - TestMethod:assertObject()
|
||||
-- @desc - used to check a table is a love object, this runs 3 seperate
|
||||
-- @desc - used to check a table is a love object, this runs 3 seperate
|
||||
-- tests to check table has the basic properties of an object
|
||||
-- @note - actual object functionality tests have their own methods
|
||||
-- @param {table} obj - table to check is a valid love object
|
||||
@@ -238,7 +238,7 @@ TestMethod = {
|
||||
table.insert(self.asserts, {
|
||||
key = 'assert ' .. tostring(self.count),
|
||||
passed = passing,
|
||||
message = 'expected \'' .. tostring(expected[1]) .. 'x,' ..
|
||||
message = 'expected \'' .. tostring(expected[1]) .. 'x,' ..
|
||||
tostring(expected[2]) .. 'y\' got \'' ..
|
||||
tostring(actual[1]) .. 'x,' .. tostring(actual[2]) .. 'y\'',
|
||||
test = label or 'no label given'
|
||||
@@ -247,7 +247,7 @@ TestMethod = {
|
||||
|
||||
|
||||
-- @method - TestMethod:assertNotNil()
|
||||
-- @desc - quick assert for value not nil
|
||||
-- @desc - quick assert for value not nil
|
||||
-- @param {any} value - value to check not nil
|
||||
-- @return {nil}
|
||||
assertNotNil = function (self, value, err)
|
||||
@@ -264,8 +264,8 @@ TestMethod = {
|
||||
|
||||
|
||||
-- @method - TestMethod:compareImg()
|
||||
-- @desc - compares a given image to the 'expected' version, with a tolerance of
|
||||
-- 1px in any direction, and then saves it as the 'actual' version for
|
||||
-- @desc - compares a given image to the 'expected' version, with a tolerance of
|
||||
-- 1px in any direction, and then saves it as the 'actual' version for
|
||||
-- report viewing
|
||||
-- @param {table} imgdata - imgdata to save as a png
|
||||
-- @return {nil}
|
||||
@@ -275,24 +275,28 @@ TestMethod = {
|
||||
local ok, chunk, _ = pcall(love.image.newImageData, expected_path)
|
||||
if ok == false then return self:assertEquals(true, false, chunk) end
|
||||
local expected = chunk
|
||||
local iw = imgdata:getWidth()-2
|
||||
local ih = imgdata:getHeight()-2
|
||||
local iw = imgdata:getWidth()-1
|
||||
local ih = imgdata:getHeight()-1
|
||||
local differences = {}
|
||||
local rgba_tolerance = self.rgba_tolerance * (1/255)
|
||||
for ix=2,iw do
|
||||
for iy=2,ih do
|
||||
|
||||
-- for each pixel, compare the expected vs the actual pixel data
|
||||
-- by default rgba_tolerance is 0
|
||||
for ix=0,iw do
|
||||
for iy=0,ih do
|
||||
local ir, ig, ib, ia = imgdata:getPixel(ix, iy)
|
||||
local points = {
|
||||
{expected:getPixel(ix, iy)}
|
||||
}
|
||||
if self.pixel_tolerance > 0 then
|
||||
table.insert(points, {expected:getPixel(ix-1, iy+1)})
|
||||
table.insert(points, {expected:getPixel(ix-1, iy)})
|
||||
table.insert(points, {expected:getPixel(ix-1, iy-1)})
|
||||
table.insert(points, {expected:getPixel(ix, iy+1)})
|
||||
table.insert(points, {expected:getPixel(ix, iy-1)})
|
||||
table.insert(points, {expected:getPixel(ix+1, iy+1)})
|
||||
table.insert(points, {expected:getPixel(ix+1, iy)})
|
||||
table.insert(points, {expected:getPixel(ix+1, iy-1)})
|
||||
if ix > 0 and iy < ih-1 then table.insert(points, {expected:getPixel(ix-1, iy+1)}) end
|
||||
if ix > 0 then table.insert(points, {expected:getPixel(ix-1, iy)}) end
|
||||
if ix > 0 and iy > 0 then table.insert(points, {expected:getPixel(ix-1, iy-1)}) end
|
||||
if iy < ih-1 then table.insert(points, {expected:getPixel(ix, iy+1)}) end
|
||||
if iy > 0 then table.insert(points, {expected:getPixel(ix, iy-1)}) end
|
||||
if ix < iw-1 and iy < ih-1 then table.insert(points, {expected:getPixel(ix+1, iy+1)}) end
|
||||
if ix < iw-1 then table.insert(points, {expected:getPixel(ix+1, iy)}) end
|
||||
if ix < iw-1 and iy > 0 then table.insert(points, {expected:getPixel(ix+1, iy-1)}) end
|
||||
end
|
||||
local has_match_r = false
|
||||
local has_match_g = false
|
||||
@@ -317,23 +321,48 @@ TestMethod = {
|
||||
tostring(ix) .. ',' .. tostring(iy) .. ', matching = ' .. ymatch ..
|
||||
', not matching = ' .. nmatch .. ' (' .. self.method .. '-' .. tostring(self.imgs) .. ')'
|
||||
)
|
||||
-- add difference co-ord for rendering later
|
||||
if matching ~= true then
|
||||
table.insert(differences, ix+1)
|
||||
table.insert(differences, iy+1)
|
||||
end
|
||||
end
|
||||
end
|
||||
local path = 'tempoutput/actual/love.test.graphics.' ..
|
||||
self.method .. '-' .. tostring(self.imgs) .. '.png'
|
||||
imgdata:encode('png', path)
|
||||
|
||||
-- if we have differences draw them to a new canvas to display in HTML report
|
||||
local dpath = 'tempoutput/difference/love.test.graphics.' ..
|
||||
self.method .. '-' .. tostring(self.imgs) .. '.png'
|
||||
if #differences > 0 then
|
||||
local difference = love.graphics.newCanvas(iw+1, ih+1)
|
||||
love.graphics.setCanvas(difference)
|
||||
love.graphics.clear(0, 0, 0, 1)
|
||||
love.graphics.setColor(1, 0, 1, 1)
|
||||
love.graphics.points(differences)
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
love.graphics.setCanvas()
|
||||
love.graphics.readbackTexture(difference):encode('png', dpath)
|
||||
|
||||
-- otherwise clear the old difference file (if any) to stop it coming up
|
||||
-- in future reports when there's no longer a difference
|
||||
elseif love.filesystem.openFile(dpath, 'r') then
|
||||
love.filesystem.remove(dpath)
|
||||
end
|
||||
|
||||
self.imgs = self.imgs + 1
|
||||
end,
|
||||
|
||||
|
||||
-- @method - TestMethod:exportImg()
|
||||
-- @desc - exports the given imgdata to the 'output/expected/' folder, to use when
|
||||
-- writing new graphics tests to set the expected image output
|
||||
-- @NOTE - you should not leave this method in when you are finished this is
|
||||
-- writing new graphics tests to set the expected image output
|
||||
-- @NOTE - you should not leave this method in when you are finished this is
|
||||
-- for test writing only
|
||||
-- @param {table} imgdata - imgdata to save as a png
|
||||
-- @param {integer} imgdata - index of the png, graphic tests are run sequentially
|
||||
-- and each test image is numbered in order that its
|
||||
-- and each test image is numbered in order that its
|
||||
-- compared to, so set the number here to match
|
||||
-- @return {nil}
|
||||
exportImg = function(self, imgdata, index)
|
||||
@@ -386,6 +415,21 @@ TestMethod = {
|
||||
return false
|
||||
end,
|
||||
|
||||
-- @method - TestMethod:isLuaVersion()
|
||||
-- @desc - checks for a specific Lua version (or list of versions)
|
||||
-- @param {number} - the minimum Lua version to check against
|
||||
-- @return {boolean} - returns true if the current Lua version is at least the given version
|
||||
isAtLeastLuaVersion = function(self, version)
|
||||
return love.test.lua_version >= version
|
||||
end,
|
||||
|
||||
-- @method - TestMethod:isLuaJITEnabled()
|
||||
-- @desc - checks if LuaJIT is enabled
|
||||
-- @return {boolean} - returns true if LuaJIT is enabled
|
||||
isLuaJITEnabled = function(self)
|
||||
return love.test.has_lua_jit
|
||||
end,
|
||||
|
||||
-- @method - TestMethod:evaluateTest()
|
||||
-- @desc - evaluates the results of all assertions for a final restult
|
||||
-- @return {nil}
|
||||
@@ -410,10 +454,10 @@ TestMethod = {
|
||||
if self.skipped then
|
||||
self.testmodule.skipped = self.testmodule.skipped + 1
|
||||
love.test.totals[3] = love.test.totals[3] + 1
|
||||
self.result = {
|
||||
total = '',
|
||||
result = "SKIP",
|
||||
passed = false,
|
||||
self.result = {
|
||||
total = '',
|
||||
result = "SKIP",
|
||||
passed = false,
|
||||
message = '(0/0) - method skipped [' .. self.skipreason .. ']',
|
||||
failures = {}
|
||||
}
|
||||
@@ -424,10 +468,10 @@ TestMethod = {
|
||||
self.passed = true
|
||||
self.testmodule.passed = self.testmodule.passed + 1
|
||||
love.test.totals[1] = love.test.totals[1] + 1
|
||||
self.result = {
|
||||
total = total,
|
||||
result = 'PASS',
|
||||
passed = true,
|
||||
self.result = {
|
||||
total = total,
|
||||
result = 'PASS',
|
||||
passed = true,
|
||||
message = nil,
|
||||
failures = {}
|
||||
}
|
||||
@@ -517,25 +561,25 @@ TestMethod = {
|
||||
local preview = ''
|
||||
if self.testmodule.module == 'graphics' then
|
||||
local filename = 'love.test.graphics.' .. self.method
|
||||
if love.filesystem.openFile('tempoutput/actual/' .. filename .. '-1.png', 'r') then
|
||||
preview = '<div class="preview">' .. '<img src="expected/' .. filename .. '-1.png"/><p>Expected</p></div>' ..
|
||||
'<div class="preview">' .. '<img src="actual/' .. filename .. '-1.png"/><p>Actual</p></div>'
|
||||
end
|
||||
if love.filesystem.openFile('tempoutput/actual/' .. filename .. '-2.png', 'r') then
|
||||
preview = preview .. '<div class="preview">' .. '<img src="expected/' .. filename .. '-2.png"/><p>Expected</p></div>' ..
|
||||
'<div class="preview">' .. '<img src="actual/' .. filename .. '-2.png"/><p>Actual</p></div>'
|
||||
end
|
||||
if love.filesystem.openFile('tempoutput/actual/' .. filename .. '-3.png', 'r') then
|
||||
preview = preview .. '<div class="preview">' .. '<img src="expected/' .. filename .. '-3.png"/><p>Expected</p></div>' ..
|
||||
'<div class="preview">' .. '<img src="actual/' .. filename .. '-3.png"/><p>Actual</p></div>'
|
||||
for f=1,5 do
|
||||
local fstr = tostring(f)
|
||||
if love.filesystem.openFile('tempoutput/actual/' .. filename .. '-' .. fstr .. '.png', 'r') then
|
||||
preview = preview .. '<div class="preview-wrap">'
|
||||
preview = preview .. '<div class="preview">' .. '<img src="expected/' .. filename .. '-' .. fstr .. '.png"/><p>Expected</p></div>' ..
|
||||
'<div class="preview">' .. '<img src="actual/' .. filename .. '-' .. fstr .. '.png"/><p>Actual</p></div>'
|
||||
if love.filesystem.openFile('tempoutput/difference/' .. filename .. '-' .. fstr .. '.png', 'r') then
|
||||
preview = preview .. '<div class="preview">' .. '<img src="difference/' .. filename .. '-' .. fstr .. '.png"/><p>Difference</p></div>'
|
||||
end
|
||||
preview = preview .. '</div>'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- append HTML for the test class result
|
||||
local status = '🔴'
|
||||
-- append HTML for the test class result
|
||||
local status = ''
|
||||
local cls = 'red'
|
||||
if self.passed then status = '🟢'; cls = '' end
|
||||
if self.skipped then status = '🟡'; cls = '' end
|
||||
if self.passed then status = '<div class="icon pass"></div>'; cls = 'green' end
|
||||
if self.skipped then status = ''; cls = 'yellow' end
|
||||
self.testmodule.html = self.testmodule.html ..
|
||||
'<tr class=" ' .. cls .. '">' ..
|
||||
'<td>' .. status .. '</td>' ..
|
||||
@@ -565,7 +609,7 @@ TestMethod = {
|
||||
self.result.total .. msg
|
||||
)
|
||||
|
||||
-- if we failed on multiple asserts, list them here - makes it easier for
|
||||
-- if we failed on multiple asserts, list them here - makes it easier for
|
||||
-- debugging new methods added that are failing multiple asserts
|
||||
if #self.result.failures > 1 then
|
||||
for f=2,#self.result.failures do
|
||||
|
||||
@@ -82,8 +82,8 @@ TestModule = {
|
||||
-- @return {nil}
|
||||
printResult = function(self)
|
||||
local finaltime = UtilTimeFormat(self.time)
|
||||
local status = '🔴'
|
||||
if self.failed == 0 then status = '🟢' end
|
||||
local status = '<div class="icon fail"></div>'
|
||||
if self.failed == 0 then status = '<div class="icon pass"></div>' end
|
||||
-- add md row to main output
|
||||
love.test.mdrows = love.test.mdrows .. '| ' .. status ..
|
||||
' ' .. self.module ..
|
||||
@@ -98,13 +98,23 @@ TestModule = {
|
||||
'" skipped="' .. tostring(self.skipped) ..
|
||||
'" time="' .. finaltime .. '">\n' .. self.xml .. '\t</testsuite>\n'
|
||||
-- add html to main output
|
||||
love.test.html = love.test.html .. '<h2>' .. status .. ' love.' .. self.module .. '</h2><ul class="summary">' ..
|
||||
'<li>🟢 ' .. tostring(self.passed) .. ' Tests</li>' ..
|
||||
'<li>🔴 ' .. tostring(self.failed) .. ' Failures</li>' ..
|
||||
'<li>🟡 ' .. tostring(self.skipped) .. ' Skipped</li>' ..
|
||||
'<li>' .. finaltime .. 's</li>' .. '<ul><br/><br/>' ..
|
||||
local module_cls = 'toggle close'
|
||||
local module_txt = '▶'
|
||||
local wrap_cls = ''
|
||||
if self.failed > 0 then
|
||||
module_cls = 'toggle open'
|
||||
module_txt = '▼'
|
||||
wrap_cls = 'fail'
|
||||
end
|
||||
love.test.html = love.test.html .. '<div class="module ' .. wrap_cls .. '">' ..
|
||||
'<div class="' .. module_cls .. '" onclick="toggle(this)">' .. module_txt .. '</div>' ..
|
||||
'<h2>' .. status .. ' love.' .. self.module .. '</h2><ul class="summary">' ..
|
||||
'<li class="l' .. tostring(self.passed) .. '">' .. tostring(self.passed) .. ' Passed</li>' ..
|
||||
'<li class="l' .. tostring(self.failed) .. '">' .. tostring(self.failed) .. ' Failed</li>' ..
|
||||
'<li class="l' .. tostring(self.skipped) .. '">' .. tostring(self.skipped) .. ' Skipped</li>' ..
|
||||
'<li>' .. finaltime .. 's</li>' .. '</ul><br/><br/>' ..
|
||||
'<table><thead><tr><td width="20px"></td><td width="100px">Method</td><td width="60px">Time</td><td>Details</td></tr></thead><tbody>' ..
|
||||
self.html .. '</tbody></table>'
|
||||
self.html .. '</tbody></table></div>'
|
||||
-- print module results to console
|
||||
self:log('yellow', 'love.' .. self.module .. '.testmodule.end')
|
||||
local failedcol = '\27[31m'
|
||||
|
||||
@@ -24,6 +24,8 @@ TestSuite = {
|
||||
fakequit = false,
|
||||
windowmode = true,
|
||||
current_os = love._os,
|
||||
lua_version = tonumber(_VERSION:match("%d%.%d")),
|
||||
has_lua_jit = type(jit) == 'table',
|
||||
|
||||
-- love modules to test
|
||||
audio = {},
|
||||
@@ -98,7 +100,7 @@ TestSuite = {
|
||||
|
||||
-- when wait finished (or no yields)
|
||||
if coroutine.status(self.test.co) == 'dead' then
|
||||
-- now we're all done evaluate the test
|
||||
-- now we're all done evaluate the test
|
||||
local ok, chunk, err = pcall(self.test.evaluateTest, self.test)
|
||||
if ok == false then
|
||||
self.test.passed = false
|
||||
@@ -129,7 +131,7 @@ TestSuite = {
|
||||
self:printResult()
|
||||
love.event.quit(0)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -152,7 +154,7 @@ TestSuite = {
|
||||
if love.graphics then
|
||||
name, version, vendor, device = love.graphics.getRendererInfo()
|
||||
end
|
||||
|
||||
|
||||
local md = '<!-- PASSED ' .. tostring(self.totals[1]) ..
|
||||
' || FAILED ' .. tostring(self.totals[2]) ..
|
||||
' || SKIPPED ' .. tostring(self.totals[3]) ..
|
||||
@@ -161,25 +163,74 @@ TestSuite = {
|
||||
finaltime .. 's** with **' ..
|
||||
tostring(self.totals[1]) .. '** passed, **' ..
|
||||
tostring(self.totals[2]) .. '** failed, and **' ..
|
||||
tostring(self.totals[3]) .. '** skipped\n\n' ..
|
||||
tostring(self.totals[3]) .. '** skipped\n\n' ..
|
||||
'Renderer: ' .. name .. ' | ' .. version .. ' | ' .. vendor .. ' | ' .. device .. '\n\n' ..
|
||||
'### Report\n' ..
|
||||
'| Module | Pass | Fail | Skip | Time |\n' ..
|
||||
'| --------------------- | ------ | ------ | ------- | ------ |\n' ..
|
||||
self.mdrows .. '\n### Failures\n' .. self.mdfailures
|
||||
|
||||
local xml = '<testsuites name="love.test" tests="' .. tostring(self.totals[1]) ..
|
||||
'" failures="' .. tostring(self.totals[2]) ..
|
||||
'" skipped="' .. tostring(self.totals[3]) ..
|
||||
local xml = '<testsuites name="love.test" tests="' .. tostring(self.totals[1]) ..
|
||||
'" failures="' .. tostring(self.totals[2]) ..
|
||||
'" skipped="' .. tostring(self.totals[3]) ..
|
||||
'" time="' .. finaltime .. '">\n'
|
||||
|
||||
local status = '🔴'
|
||||
if self.totals[2] == 0 then status = '🟢' end
|
||||
local html = '<html><head><style>* { font-family: monospace; margin: 0; font-size: 11px; padding: 0; } body { margin: 50px; } h1 { padding-bottom: 10px; font-size: 13px; } h2 { padding: 20px 0 10px 0; font-size: 12px; } .summary { list-style: none; margin: 0; padding: 0; } .summary li { float: left; background: #eee; padding: 5px; margin-right: 10px; } table { background: #eee; margin-top: 10px; width: 100%; max-width: 800px; border-collapse: collapse } table thead { background: #ddd; } table th, table td { padding: 2px; } tr.red { color: red } .wrap { max-width: 800px; margin: auto; } .preview { width: 64px; height: 80px; float: left; margin-right: 10px; } .preview img { width: 100% } .preview p { text-align: center; }</style></head><body><div class="wrap"><h1>' .. status .. ' love.test</h1><ul class="summary">'
|
||||
html = html ..
|
||||
'<li>🟢 ' .. tostring(self.totals[1]) .. ' Tests</li>' ..
|
||||
'<li>🔴 ' .. tostring(self.totals[2]) .. ' Failures</li>' ..
|
||||
'<li>🟡 ' .. tostring(self.totals[3]) .. ' Skipped</li>' ..
|
||||
local status = '<div class="icon fail"></div>'
|
||||
if self.totals[2] == 0 then status = '<div class="icon pass"></div>' end
|
||||
local html = [[
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
* { font-family: monospace; margin: 0; font-size: 11px; padding: 0; }
|
||||
body { margin: 40px 50px 50px 50px; overflow-y: scroll; background: #222; }
|
||||
h1 { font-weight: normal; color: #eee; font-size: 12px; width: 140px; border-radius: 2px; padding: 5px 0; float: left; background: #333; }
|
||||
h2 { font-weight: normal; color: #eee; font-size: 12px; width: 140px; border-radius: 2px; }
|
||||
.summary { z-index: 10; position: relative; list-style: none; margin: 0; padding: 0; float: right; }
|
||||
.summary li { color: #111; float: left; border-radius: 2px; background: #eee; padding: 5px; margin-right: 10px; text-align: right; }
|
||||
table { color: #eee; background: #444; margin: 5px 0 0 10px; width: calc(100% - 20px); max-width: 800px; border-collapse: collapse }
|
||||
table thead { background: #333; }
|
||||
table th, table td { padding: 2px 4px; font-size: 11px; }
|
||||
tr.red { background: #d26666; color: #111; }
|
||||
tr.yellow { background: slategrey; }
|
||||
.wrap { max-width: 800px; padding-top: 30px; margin: auto; position: relative; }
|
||||
.preview-wrap { display: inline-block; height: 80px; padding: 5px 0 0 5px; margin: 5px; background: rgba(0, 0, 0, 0.1); }
|
||||
.preview { width: 64px; height: 80px; float: left; margin-right: 10px; }
|
||||
.preview:nth-last-child(1) { margin-right: 5px; }
|
||||
.preview img { width: 100%; image-rendering: pixelated; }
|
||||
.preview p { text-align: center; }
|
||||
.module { margin-top: 10px; position: relative; }
|
||||
.module h2 { float: left; margin: 0; padding: 5px 0 0 35px; }
|
||||
.module .toggle { background: #2d9966; color: #111; left: 10px; width: 14px; border-radius: 2px; padding: 6px; text-align: center; cursor: pointer; position: absolute; }
|
||||
.module.fail .toggle { background: #d26666; }
|
||||
.module.fail h2 { color: #d26666; }
|
||||
.toggle.close ~ table { display: none; }
|
||||
.summary li:nth-child(1) { background: #2d9966; min-width: 70px; }
|
||||
.summary li:nth-child(2) { background: #d26666; min-width: 70px; }
|
||||
.summary li:nth-child(3) { background: slategrey; min-width: 70px; }
|
||||
.summary li:nth-child(4) { background: #bbb; min-width: 60px; }
|
||||
.summary li.l0 { opacity: 0.2; }
|
||||
.renderer { position: absolute; top: 8px; right: 10px; color: #eee; }
|
||||
h1 { width: 100%; top: 0; position: absolute; height: 50px; left: 0; }
|
||||
table .icon.pass { position: relative; width: 8px; height: 8px; border-radius: 8px; margin-left: 6px; }
|
||||
table .icon.pass:after { content: '✓'; top: -3px; position: absolute; color: #2d9966; font-size: 12px; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function toggle(el) {
|
||||
el.className = el.className == 'toggle close' ? 'toggle open' : 'toggle close';
|
||||
el.innerText = el.className == 'toggle close' ? '▶' : '▼';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>]]
|
||||
local wrap_cls = ''
|
||||
if self.totals[2] > 0 then wrap_cls = 'fail' end
|
||||
html = html .. '<div class="wrap ' .. wrap_cls .. '"><h1>' .. status .. ' love.test report</h1>' ..
|
||||
'<p class="renderer">Renderer: ' .. name .. ' | ' .. version .. ' | ' .. vendor .. ' | ' .. device .. '</p>' ..
|
||||
'<ul class="summary">'
|
||||
html = html ..
|
||||
'<li>' .. tostring(self.totals[1]) .. ' Passed</li>' ..
|
||||
'<li>' .. tostring(self.totals[2]) .. ' Failed</li>' ..
|
||||
'<li>' .. tostring(self.totals[3]) .. ' Skipped</li>' ..
|
||||
'<li>' .. finaltime .. 's</li></ul><br/><br/>'
|
||||
|
||||
love.filesystem.write('tempoutput/' .. self.output .. '.xml', xml .. self.xml .. '</testsuites>')
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,33 +1,41 @@
|
||||
<!-- PASSED 335 || FAILED 0 || SKIPPED 9 || TIME 14.817 -->
|
||||
<!-- PASSED 343 || FAILED 2 || SKIPPED 10 || TIME 14.567 -->
|
||||
|
||||
### Info
|
||||
**344** tests were completed in **14.817s** with **335** passed, **0** failed, and **9** skipped
|
||||
**355** tests were completed in **14.567s** with **343** passed, **2** failed, and **10** skipped
|
||||
|
||||
Renderer: OpenGL | 4.1 Metal - 76.3 | Apple | Apple M1 Max
|
||||
|
||||
### Report
|
||||
| Module | Pass | Fail | Skip | Time |
|
||||
| --------------------- | ------ | ------ | ------- | ------ |
|
||||
| 🟢 audio | 28 | 0 | 0 | 0.886s |
|
||||
| 🟢 data | 12 | 0 | 0 | 0.212s |
|
||||
| 🟢 event | 4 | 0 | 2 | 0.103s |
|
||||
| 🟢 filesystem | 29 | 0 | 2 | 0.555s |
|
||||
| 🟢 font | 7 | 0 | 0 | 0.124s |
|
||||
| 🟢 graphics | 104 | 0 | 1 | 3.006s |
|
||||
| 🟢 image | 5 | 0 | 0 | 0.085s |
|
||||
| 🟢 joystick | 6 | 0 | 0 | 0.106s |
|
||||
| 🟢 keyboard | 9 | 0 | 0 | 0.150s |
|
||||
| 🟢 love | 6 | 0 | 0 | 0.098s |
|
||||
| 🟢 math | 20 | 0 | 0 | 0.337s |
|
||||
| 🟢 mouse | 18 | 0 | 0 | 0.302s |
|
||||
| 🟢 physics | 26 | 0 | 0 | 0.434s |
|
||||
| 🟢 sensor | 1 | 0 | 0 | 0.016s |
|
||||
| 🟢 sound | 4 | 0 | 0 | 0.072s |
|
||||
| 🟢 system | 6 | 0 | 2 | 0.135s |
|
||||
| 🟢 thread | 5 | 0 | 0 | 0.363s |
|
||||
| 🟢 timer | 6 | 0 | 0 | 2.074s |
|
||||
| 🟢 touch | 3 | 0 | 0 | 0.023s |
|
||||
| 🟢 video | 2 | 0 | 0 | 0.039s |
|
||||
| 🟢 window | 34 | 0 | 2 | 5.696s |
|
||||
| 🟢 audio | 31 | 0 | 0 | 1.328s |
|
||||
| 🟢 data | 12 | 0 | 0 | 0.197s |
|
||||
| 🟢 event | 4 | 0 | 2 | 0.100s |
|
||||
| 🟢 filesystem | 33 | 0 | 2 | 0.601s |
|
||||
| 🟢 font | 7 | 0 | 0 | 0.116s |
|
||||
| 🔴 graphics | 104 | 1 | 2 | 3.463s |
|
||||
| 🟢 image | 5 | 0 | 0 | 0.093s |
|
||||
| 🟢 joystick | 6 | 0 | 0 | 0.116s |
|
||||
| 🟢 keyboard | 10 | 0 | 0 | 0.170s |
|
||||
| 🟢 love | 6 | 0 | 0 | 0.100s |
|
||||
| 🟢 math | 20 | 0 | 0 | 0.334s |
|
||||
| 🔴 mouse | 17 | 1 | 0 | 0.301s |
|
||||
| 🟢 physics | 26 | 0 | 0 | 0.435s |
|
||||
| 🟢 sensor | 1 | 0 | 0 | 0.017s |
|
||||
| 🟢 sound | 4 | 0 | 0 | 0.075s |
|
||||
| 🟢 system | 7 | 0 | 2 | 0.150s |
|
||||
| 🟢 thread | 5 | 0 | 0 | 0.306s |
|
||||
| 🟢 timer | 6 | 0 | 0 | 0.298s |
|
||||
| 🟢 touch | 3 | 0 | 0 | 0.051s |
|
||||
| 🟢 video | 2 | 0 | 0 | 0.038s |
|
||||
| 🟢 window | 34 | 0 | 2 | 6.275s |
|
||||
|
||||
### Failures
|
||||
> 🔴 Shader
|
||||
> assert 4 [check shader valid] expected '' got 'vertex shader:
|
||||
pixel shader:
|
||||
'
|
||||
|
||||
> 🔴 setGrabbed
|
||||
> assert 2 [check now grabbed] expected 'true' got 'false'
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
# Graphic Differences
|
||||
If a graphics test fails then a "difference" image will be created to highlight
|
||||
the differences between the actual + expected image, for use in the HTML report
|
||||
@@ -137,7 +137,7 @@ end
|
||||
|
||||
-- love.filesystem.createDirectory
|
||||
love.test.filesystem.createDirectory = function(test)
|
||||
-- try creating a dir + subdir and check both exist
|
||||
-- try creating a dir + subdir and check both exist
|
||||
local success = love.filesystem.createDirectory('foo/bar')
|
||||
test:assertNotEquals(false, success, 'check success')
|
||||
test:assertNotEquals(nil, love.filesystem.getInfo('foo', 'directory'), 'check directory created')
|
||||
@@ -225,7 +225,7 @@ love.test.filesystem.getRealDirectory = function(test)
|
||||
love.filesystem.createDirectory('foo')
|
||||
love.filesystem.write('foo/test.txt', 'test')
|
||||
-- check save dir matches the real dir we just wrote to
|
||||
test:assertEquals(love.filesystem.getSaveDirectory(),
|
||||
test:assertEquals(love.filesystem.getSaveDirectory(),
|
||||
love.filesystem.getRealDirectory('foo/test.txt'), 'check directory matches')
|
||||
-- cleanup
|
||||
love.filesystem.remove('foo/test.txt')
|
||||
@@ -321,17 +321,28 @@ love.test.filesystem.load = function(test)
|
||||
-- setup some fake lua files
|
||||
love.filesystem.write('test1.lua', 'function test()\nreturn 1\nend\nreturn test()')
|
||||
love.filesystem.write('test2.lua', 'function test()\nreturn 1')
|
||||
-- check file that doesn't exist
|
||||
local chunk1, errormsg1 = love.filesystem.load('faker.lua', 'b')
|
||||
test:assertEquals(nil, chunk1, 'check file doesnt exist')
|
||||
-- check valid lua file (text load)
|
||||
local chunk2, errormsg2 = love.filesystem.load('test1.lua', 't')
|
||||
test:assertEquals(nil, errormsg2, 'check no error message')
|
||||
test:assertEquals(1, chunk2(), 'check lua file runs')
|
||||
|
||||
if test:isAtLeastLuaVersion(5.2) or test:isLuaJITEnabled() then
|
||||
-- check file that doesn't exist
|
||||
local chunk1, errormsg1 = love.filesystem.load('faker.lua', 'b')
|
||||
test:assertEquals(nil, chunk1, 'check file doesnt exist')
|
||||
-- check valid lua file (text load)
|
||||
local chunk2, errormsg2 = love.filesystem.load('test1.lua', 't')
|
||||
test:assertEquals(nil, errormsg2, 'check no error message')
|
||||
test:assertEquals(1, chunk2(), 'check lua file runs')
|
||||
else
|
||||
local _, errormsg3 = love.filesystem.load('test1.lua', 'b')
|
||||
test:assertNotEquals(nil, errormsg3, 'check for an error message')
|
||||
|
||||
local _, errormsg4 = love.filesystem.load('test1.lua', 't')
|
||||
test:assertNotEquals(nil, errormsg4, 'check for an error message')
|
||||
end
|
||||
|
||||
-- check valid lua file (any load)
|
||||
local chunk4, errormsg4 = love.filesystem.load('test1.lua', 'bt')
|
||||
test:assertEquals(nil, errormsg2, 'check no error message')
|
||||
test:assertEquals(1, chunk4(), 'check lua file runs')
|
||||
local chunk5, errormsg5 = love.filesystem.load('test1.lua', 'bt')
|
||||
test:assertEquals(nil, errormsg5, 'check no error message')
|
||||
test:assertEquals(1, chunk5(), 'check lua file runs')
|
||||
|
||||
-- check invalid lua file
|
||||
local ok, chunk, err = pcall(love.filesystem.load, 'test2.lua')
|
||||
test:assertFalse(ok, 'check invalid lua file')
|
||||
@@ -410,7 +421,7 @@ end
|
||||
|
||||
-- love.filesystem.unmountCommonPath
|
||||
--love.test.filesystem.unmountCommonPath = function(test)
|
||||
-- -- check unmounting invalid
|
||||
-- -- check unmounting invalid
|
||||
-- local ok = pcall(love.filesystem.unmountCommonPath, 'fakepath')
|
||||
-- test:assertFalse(ok, 'check unmount invalid common path')
|
||||
-- -- check mounting valid paths
|
||||
|
||||
@@ -23,8 +23,6 @@ These are all the outstanding methods that require test coverage, along with a f
|
||||
- love.graphics.drawIndirect()
|
||||
- love.graphics.getQuadIndexBuffer()
|
||||
- love.graphics.setBlendState()
|
||||
- love.graphics.setOrthoProjection()
|
||||
- love.graphics.setPerspectiveProjection()
|
||||
- love.graphics.resetProjection()
|
||||
- love.graphics.Mesh:getAttachedAttributes()
|
||||
- love.graphics.Shader:hasStage()
|
||||
|
||||
Reference in New Issue
Block a user