- Added tests for all obj creation, transformation, window + system info graphics methods
- Added half the state methods for graphics + added placeholders for missing drawing methods
- Added TestMethod:assertNotNil() for quick nil checking
- Added time total to the end of each module summary in console log to match file output

- Removed a bunch of unessecary nil checks
- Removed :release() from test methods, collectgarbage("collect") is called between methods instead

- Renamed /output to /examples to avoid confusion

- Replaced love.filesystem.newFile with love.filesystem.openFile
- Replaced love.math.noise with love.math.perlinNoise / love.math.simplexNoise

- Fixed newGearJoint throwing an error in 12 as body needs to be dynamic not static now

- Some general cleanup, incl. better comments and time format in file output
This commit is contained in:
ell
2023-10-05 23:03:32 +01:00
parent 08467cb4fa
commit e03b2db08b
30 changed files with 1982 additions and 866 deletions
+16 -10
View File
@@ -189,14 +189,23 @@ TestMethod = {
-- @param {table} obj - table to check is a valid love object
-- @return {nil}
assertObject = function(self, obj)
self:assertNotEquals(nil, obj, 'check not nill')
self:assertNotNil(obj)
self:assertEquals('userdata', type(obj), 'check is userdata')
if obj ~= nil then
if obj ~= nil then
self:assertNotEquals(nil, obj:type(), 'check has :type()')
end
end,
-- @method - TestMethod:assertNotNil()
-- @desc - quick assert for value not nil
-- @param {any} value - value to check not nil
-- @return {nil}
assertNotNil = function (self, value)
self:assertNotEquals(nil, value, 'check not nil')
end,
-- @method - TestMethod:skipTest()
-- @desc - used to mark this test as skipped for a specific reason
@@ -289,10 +298,7 @@ TestMethod = {
self.finish = love.timer.getTime() - self.start
love.test.time = love.test.time + self.finish
self.testmodule.time = self.testmodule.time + self.finish
local endtime = tostring(math.floor((love.timer.getTime() - self.start)*1000))
if string.len(endtime) == 1 then endtime = ' ' .. endtime end
if string.len(endtime) == 2 then endtime = ' ' .. endtime end
if string.len(endtime) == 3 then endtime = ' ' .. endtime end
local endtime = UtilTimeFormat(love.timer.getTime() - self.start)
-- get failure/skip message for output (if any)
local failure = ''
@@ -309,7 +315,7 @@ TestMethod = {
-- append XML for the test class result
self.testmodule.xml = self.testmodule.xml .. '\t\t<testclass classname="' ..
self.method .. '" name="' .. self.method ..
'" time="' .. tostring(self.finish*1000) .. '">\n' ..
'" time="' .. endtime .. '">\n' ..
failure .. '\t\t</testclass>\n'
-- unused currently, adds a preview image for certain graphics methods to the output
@@ -329,7 +335,7 @@ TestMethod = {
'<tr class=" ' .. cls .. '">' ..
'<td>' .. status .. '</td>' ..
'<td>' .. self.method .. '</td>' ..
'<td>' .. tostring(self.finish*1000) .. 'ms</td>' ..
'<td>' .. endtime .. 's</td>' ..
'<td>' .. output .. preview .. '</td>' ..
'</tr>'
@@ -350,10 +356,10 @@ TestMethod = {
self.testmodule:log(
self.testmodule.colors[self.result.result],
' ' .. tested .. matching,
' ==> ' .. self.result.result .. ' - ' .. endtime .. 'ms ' ..
' ==> ' .. self.result.result .. ' - ' .. endtime .. 's ' ..
self.result.total .. msg
)
end
}
}
+6 -5
View File
@@ -83,12 +83,13 @@ TestModule = {
-- the XML + HTML for the test to the testsuite output
-- @return {nil}
printResult = function(self)
local finaltime = UtilTimeFormat(self.time)
-- add xml to main output
love.test.xml = love.test.xml .. '\t<testsuite name="love.' .. self.module ..
'" tests="' .. tostring(self.passed) ..
'" failures="' .. tostring(self.failed) ..
'" skipped="' .. tostring(self.skipped) ..
'" time="' .. tostring(self.time*1000) .. '">\n' .. self.xml .. '\t</testsuite>\n'
'" time="' .. finaltime .. '">\n' .. self.xml .. '\t</testsuite>\n'
-- add html to main output
local status = '🔴'
if self.failed == 0 then status = '🟢' end
@@ -96,8 +97,8 @@ TestModule = {
'<li>🟢&nbsp;' .. tostring(self.passed) .. ' Tests</li>' ..
'<li>🔴&nbsp;' .. tostring(self.failed) .. ' Failures</li>' ..
'<li>🟡&nbsp;' .. tostring(self.skipped) .. ' Skipped</li>' ..
'<li>' .. tostring(self.time*1000) .. 'ms</li>' .. '<ul><br/><br/>' ..
'<table><thead><tr><td width="20px"></td><td width="100px">Method</td><td width="100px">Time</td><td>Details</td></tr></thead><tbody>' ..
'<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>'
-- print module results to console
self:log('yellow', 'love.' .. self.module .. '.testmodule.end')
@@ -105,10 +106,10 @@ TestModule = {
if self.failed == 0 then failedcol = '\27[37m' end
self:log('green', tostring(self.passed) .. ' PASSED' .. ' || ' ..
failedcol .. tostring(self.failed) .. ' FAILED || \27[37m' ..
tostring(self.skipped) .. ' SKIPPED')
tostring(self.skipped) .. ' SKIPPED || ' .. finaltime .. 's')
self.start = false
self.fakequit = false
end
}
}
+9 -9
View File
@@ -10,7 +10,7 @@ TestSuite = {
-- testsuite internals
modules = {},
module = nil,
testcanvas = love.graphics.newCanvas(16, 16),
testcanvas = nil,
current = 1,
output = '',
totals = {0, 0, 0},
@@ -91,6 +91,9 @@ TestSuite = {
test.fatal = tostring(chunk) .. tostring(err)
end
end
-- save having to :release() anything we made in the last test
-- 7251ms > 7543ms
collectgarbage("collect")
-- move onto the next test
self.module.index = self.module.index + 1
end
@@ -124,15 +127,12 @@ TestSuite = {
-- the XML + HTML of the testsuite output
-- @return {nil}
printResult = function(self)
local finaltime = tostring(math.floor(self.time*1000))
if string.len(finaltime) == 1 then finaltime = ' ' .. finaltime end
if string.len(finaltime) == 2 then finaltime = ' ' .. finaltime end
if string.len(finaltime) == 3 then finaltime = ' ' .. finaltime end
local finaltime = UtilTimeFormat(self.time)
local xml = '<testsuites name="love.test" tests="' .. tostring(self.totals[1]) ..
'" failures="' .. tostring(self.totals[2]) ..
'" skipped="' .. tostring(self.totals[3]) ..
'" time="' .. tostring(self.time*1000) .. '">\n'
'" time="' .. finaltime .. '">\n'
local status = '🔴'
if self.totals[2] == 0 then status = '🟢' end
@@ -141,14 +141,14 @@ TestSuite = {
'<li>🟢&nbsp;' .. tostring(self.totals[1]) .. ' Tests</li>' ..
'<li>🔴&nbsp;' .. tostring(self.totals[2]) .. ' Failures</li>' ..
'<li>🟡&nbsp;' .. tostring(self.totals[3]) .. ' Skipped</li>' ..
'<li>' .. tostring(self.time*1000) .. 'ms</li></ul><br/><br/>'
'<li>' .. finaltime .. 's</li></ul><br/><br/>'
-- @TODO use mountFullPath to write output to src?
love.filesystem.createDirectory('output')
love.filesystem.write('output/' .. self.output .. '.xml', xml .. self.xml .. '</testsuites>')
love.filesystem.write('output/' .. self.output .. '.html', html .. self.html .. '</div></body></html>')
self.module:log('grey', '\nFINISHED - ' .. finaltime .. 'ms\n')
self.module:log('grey', '\nFINISHED - ' .. finaltime .. 's\n')
local failedcol = '\27[31m'
if self.totals[2] == 0 then failedcol = '\27[37m' end
self.module:log('green', tostring(self.totals[1]) .. ' PASSED' .. ' || ' .. failedcol .. tostring(self.totals[2]) .. ' FAILED || \27[37m' .. tostring(self.totals[3]) .. ' SKIPPED')
@@ -156,4 +156,4 @@ TestSuite = {
end
}
}
+1 -1
View File
@@ -21,4 +21,4 @@ function love.conf(t)
t.modules.timer = true
t.modules.video = true
t.modules.window = true
end
end
File diff suppressed because one or more lines are too long
+578
View File
@@ -0,0 +1,578 @@
<testsuites name="love.test" tests="226" failures="2" skipped="43" time="7.563">
<testsuite name="love.audio" tests="26" failures="0" skipped="0" time="0.006">
<testclass classname="getActiveEffects" name="getActiveEffects" time="0.000">
</testclass>
<testclass classname="getActiveSourceCount" name="getActiveSourceCount" time="0.001">
</testclass>
<testclass classname="getDistanceModel" name="getDistanceModel" time="0.000">
</testclass>
<testclass classname="getDopplerScale" name="getDopplerScale" time="0.000">
</testclass>
<testclass classname="getEffect" name="getEffect" time="0.000">
</testclass>
<testclass classname="getMaxSceneEffects" name="getMaxSceneEffects" time="0.000">
</testclass>
<testclass classname="getMaxSourceEffects" name="getMaxSourceEffects" time="0.000">
</testclass>
<testclass classname="getOrientation" name="getOrientation" time="0.000">
</testclass>
<testclass classname="getPosition" name="getPosition" time="0.000">
</testclass>
<testclass classname="getRecordingDevices" name="getRecordingDevices" time="0.000">
</testclass>
<testclass classname="getVelocity" name="getVelocity" time="0.000">
</testclass>
<testclass classname="getVolume" name="getVolume" time="0.000">
</testclass>
<testclass classname="isEffectsSupported" name="isEffectsSupported" time="0.000">
</testclass>
<testclass classname="newQueueableSource" name="newQueueableSource" time="0.000">
</testclass>
<testclass classname="newSource" name="newSource" time="0.001">
</testclass>
<testclass classname="pause" name="pause" time="0.001">
</testclass>
<testclass classname="play" name="play" time="0.001">
</testclass>
<testclass classname="setDistanceModel" name="setDistanceModel" time="0.000">
</testclass>
<testclass classname="setDopplerScale" name="setDopplerScale" time="0.000">
</testclass>
<testclass classname="setEffect" name="setEffect" time="0.000">
</testclass>
<testclass classname="setMixWithSystem" name="setMixWithSystem" time="0.000">
</testclass>
<testclass classname="setOrientation" name="setOrientation" time="0.000">
</testclass>
<testclass classname="setPosition" name="setPosition" time="0.000">
</testclass>
<testclass classname="setVelocity" name="setVelocity" time="0.000">
</testclass>
<testclass classname="setVolume" name="setVolume" time="0.000">
</testclass>
<testclass classname="stop" name="stop" time="0.001">
</testclass>
</testsuite>
<testsuite name="love.data" tests="7" failures="0" skipped="3" time="0.001">
<testclass classname="compress" name="compress" time="0.000">
</testclass>
<testclass classname="decode" name="decode" time="0.000">
</testclass>
<testclass classname="decompress" name="decompress" time="0.000">
</testclass>
<testclass classname="encode" name="encode" time="0.000">
</testclass>
<testclass classname="getPackedSize" name="getPackedSize" time="0.000">
</testclass>
<testclass classname="hash" name="hash" time="0.000">
</testclass>
<testclass classname="newByteData" name="newByteData" time="0.000">
</testclass>
<testclass classname="newDataView" name="newDataView" time="0.000">
</testclass>
<testclass classname="pack" name="pack" time="0.000">
</testclass>
<testclass classname="unpack" name="unpack" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.event" tests="4" failures="0" skipped="2" time="0.000">
<testclass classname="clear" name="clear" time="0.000">
</testclass>
<testclass classname="poll" name="poll" time="0.000">
</testclass>
<testclass classname="pump" name="pump" time="0.000">
</testclass>
<testclass classname="push" name="push" time="0.000">
</testclass>
<testclass classname="quit" name="quit" time="0.000">
</testclass>
<testclass classname="wait" name="wait" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.filesystem" tests="27" failures="0" skipped="2" time="0.018">
<testclass classname="append" name="append" time="0.002">
</testclass>
<testclass classname="areSymlinksEnabled" name="areSymlinksEnabled" time="0.000">
</testclass>
<testclass classname="createDirectory" name="createDirectory" time="0.001">
</testclass>
<testclass classname="getAppdataDirectory" name="getAppdataDirectory" time="0.000">
</testclass>
<testclass classname="getCRequirePath" name="getCRequirePath" time="0.000">
</testclass>
<testclass classname="getDirectoryItems" name="getDirectoryItems" time="0.002">
</testclass>
<testclass classname="getIdentity" name="getIdentity" time="0.000">
</testclass>
<testclass classname="getInfo" name="getInfo" time="0.002">
</testclass>
<testclass classname="getRealDirectory" name="getRealDirectory" time="0.001">
</testclass>
<testclass classname="getRequirePath" name="getRequirePath" time="0.000">
</testclass>
<testclass classname="getSaveDirectory" name="getSaveDirectory" time="0.000">
</testclass>
<testclass classname="getSource" name="getSource" time="0.000">
</testclass>
<testclass classname="getSourceBaseDirectory" name="getSourceBaseDirectory" time="0.000">
</testclass>
<testclass classname="getUserDirectory" name="getUserDirectory" time="0.000">
</testclass>
<testclass classname="getWorkingDirectory" name="getWorkingDirectory" time="0.000">
</testclass>
<testclass classname="isFused" name="isFused" time="0.000">
</testclass>
<testclass classname="lines" name="lines" time="0.001">
</testclass>
<testclass classname="load" name="load" time="0.001">
</testclass>
<testclass classname="mount" name="mount" time="0.002">
</testclass>
<testclass classname="newFileData" name="newFileData" time="0.000">
</testclass>
<testclass classname="openFile" name="openFile" time="0.000">
</testclass>
<testclass classname="read" name="read" time="0.000">
</testclass>
<testclass classname="remove" name="remove" time="0.002">
</testclass>
<testclass classname="setCRequirePath" name="setCRequirePath" time="0.000">
</testclass>
<testclass classname="setIdentity" name="setIdentity" time="0.000">
</testclass>
<testclass classname="setRequirePath" name="setRequirePath" time="0.000">
</testclass>
<testclass classname="setSource" name="setSource" time="0.000">
</testclass>
<testclass classname="unmount" name="unmount" time="0.002">
</testclass>
<testclass classname="write" name="write" time="0.002">
</testclass>
</testsuite>
<testsuite name="love.font" tests="4" failures="0" skipped="1" time="0.002">
<testclass classname="newBMFontRasterizer" name="newBMFontRasterizer" time="0.000">
</testclass>
<testclass classname="newGlyphData" name="newGlyphData" time="0.001">
</testclass>
<testclass classname="newImageRasterizer" name="newImageRasterizer" time="0.000">
</testclass>
<testclass classname="newRasterizer" name="newRasterizer" time="0.000">
</testclass>
<testclass classname="newTrueTypeRasterizer" name="newTrueTypeRasterizer" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.graphics" tests="65" failures="0" skipped="31" time="0.079">
<testclass classname="applyTransform" name="applyTransform" time="0.002">
</testclass>
<testclass classname="arc" name="arc" time="0.000">
</testclass>
<testclass classname="captureScreenshot" name="captureScreenshot" time="0.000">
</testclass>
<testclass classname="circle" name="circle" time="0.000">
</testclass>
<testclass classname="clear" name="clear" time="0.000">
</testclass>
<testclass classname="discard" name="discard" time="0.000">
</testclass>
<testclass classname="draw" name="draw" time="0.000">
</testclass>
<testclass classname="drawInstanced" name="drawInstanced" time="0.000">
</testclass>
<testclass classname="drawLayer" name="drawLayer" time="0.000">
</testclass>
<testclass classname="ellipse" name="ellipse" time="0.000">
</testclass>
<testclass classname="flushBatch" name="flushBatch" time="0.000">
</testclass>
<testclass classname="getBackgroundColor" name="getBackgroundColor" time="0.000">
</testclass>
<testclass classname="getBlendMode" name="getBlendMode" time="0.000">
</testclass>
<testclass classname="getCanvas" name="getCanvas" time="0.000">
</testclass>
<testclass classname="getColor" name="getColor" time="0.000">
</testclass>
<testclass classname="getColorMask" name="getColorMask" time="0.000">
</testclass>
<testclass classname="getDPIScale" name="getDPIScale" time="0.000">
</testclass>
<testclass classname="getDefaultFilter" name="getDefaultFilter" time="0.000">
</testclass>
<testclass classname="getDepthMode" name="getDepthMode" time="0.000">
</testclass>
<testclass classname="getDimensions" name="getDimensions" time="0.000">
</testclass>
<testclass classname="getFont" name="getFont" time="0.001">
</testclass>
<testclass classname="getFrontFaceWinding" name="getFrontFaceWinding" time="0.000">
</testclass>
<testclass classname="getHeight" name="getHeight" time="0.000">
</testclass>
<testclass classname="getLineJoin" name="getLineJoin" time="0.000">
</testclass>
<testclass classname="getLineStyle" name="getLineStyle" time="0.000">
</testclass>
<testclass classname="getLineWidth" name="getLineWidth" time="0.000">
</testclass>
<testclass classname="getMeshCullMode" name="getMeshCullMode" time="0.000">
</testclass>
<testclass classname="getPixelDimensions" name="getPixelDimensions" time="0.000">
</testclass>
<testclass classname="getPixelHeight" name="getPixelHeight" time="0.000">
</testclass>
<testclass classname="getPixelWidth" name="getPixelWidth" time="0.000">
</testclass>
<testclass classname="getPointSize" name="getPointSize" time="0.000">
</testclass>
<testclass classname="getRendererInfo" name="getRendererInfo" time="0.000">
</testclass>
<testclass classname="getScissor" name="getScissor" time="0.000">
</testclass>
<testclass classname="getShader" name="getShader" time="0.000">
</testclass>
<testclass classname="getStackDepth" name="getStackDepth" time="0.000">
</testclass>
<testclass classname="getStats" name="getStats" time="0.000">
</testclass>
<testclass classname="getStencilMode" name="getStencilMode" time="0.000">
</testclass>
<testclass classname="getSupported" name="getSupported" time="0.000">
</testclass>
<testclass classname="getSystemLimits" name="getSystemLimits" time="0.000">
</testclass>
<testclass classname="getTextureFormats" name="getTextureFormats" time="0.001">
</testclass>
<testclass classname="getTextureTypes" name="getTextureTypes" time="0.000">
</testclass>
<testclass classname="getWidth" name="getWidth" time="0.000">
</testclass>
<testclass classname="intersectScissor" name="intersectScissor" time="0.003">
</testclass>
<testclass classname="inverseTransformPoint" name="inverseTransformPoint" time="0.000">
</testclass>
<testclass classname="isActive" name="isActive" time="0.000">
</testclass>
<testclass classname="isGammaCorrect" name="isGammaCorrect" time="0.000">
</testclass>
<testclass classname="isWireframe" name="isWireframe" time="0.000">
</testclass>
<testclass classname="line" name="line" time="0.000">
</testclass>
<testclass classname="newArrayImage" name="newArrayImage" time="0.002">
</testclass>
<testclass classname="newCanvas" name="newCanvas" time="0.001">
</testclass>
<testclass classname="newCubeImage" name="newCubeImage" time="0.003">
</testclass>
<testclass classname="newFont" name="newFont" time="0.001">
</testclass>
<testclass classname="newImage" name="newImage" time="0.001">
</testclass>
<testclass classname="newImageFont" name="newImageFont" time="0.001">
</testclass>
<testclass classname="newMesh" name="newMesh" time="0.000">
</testclass>
<testclass classname="newParticleSystem" name="newParticleSystem" time="0.002">
</testclass>
<testclass classname="newQuad" name="newQuad" time="0.002">
</testclass>
<testclass classname="newShader" name="newShader" time="0.015">
</testclass>
<testclass classname="newSpriteBatch" name="newSpriteBatch" time="0.001">
</testclass>
<testclass classname="newTextBatch" name="newTextBatch" time="0.002">
</testclass>
<testclass classname="newVideo" name="newVideo" time="0.004">
</testclass>
<testclass classname="newVolumeImage" name="newVolumeImage" time="0.001">
</testclass>
<testclass classname="origin" name="origin" time="0.000">
</testclass>
<testclass classname="points" name="points" time="0.000">
</testclass>
<testclass classname="polygon" name="polygon" time="0.000">
</testclass>
<testclass classname="pop" name="pop" time="0.001">
</testclass>
<testclass classname="present" name="present" time="0.000">
</testclass>
<testclass classname="print" name="print" time="0.000">
</testclass>
<testclass classname="printf" name="printf" time="0.000">
</testclass>
<testclass classname="push" name="push" time="0.002">
</testclass>
<testclass classname="rectangle" name="rectangle" time="0.007">
</testclass>
<testclass classname="replaceTransform" name="replaceTransform" time="0.002">
</testclass>
<testclass classname="reset" name="reset" time="0.001">
</testclass>
<testclass classname="rotate" name="rotate" time="0.004">
</testclass>
<testclass classname="scale" name="scale" time="0.002">
</testclass>
<testclass classname="setBackgroundColor" name="setBackgroundColor" time="0.000">
</testclass>
<testclass classname="setBlendMode" name="setBlendMode" time="0.001">
</testclass>
<testclass classname="setCanvas" name="setCanvas" time="0.000">
</testclass>
<testclass classname="setColor" name="setColor" time="0.000">
</testclass>
<testclass classname="setColorMask" name="setColorMask" time="0.000">
</testclass>
<testclass classname="setDefaultFilter" name="setDefaultFilter" time="0.000">
</testclass>
<testclass classname="setDepthMode" name="setDepthMode" time="0.000">
</testclass>
<testclass classname="setFont" name="setFont" time="0.000">
</testclass>
<testclass classname="setFrontFaceWinding" name="setFrontFaceWinding" time="0.000">
</testclass>
<testclass classname="setLineJoin" name="setLineJoin" time="0.000">
</testclass>
<testclass classname="setLineStyle" name="setLineStyle" time="0.000">
</testclass>
<testclass classname="setLineWidth" name="setLineWidth" time="0.000">
</testclass>
<testclass classname="setMeshCullMode" name="setMeshCullMode" time="0.000">
</testclass>
<testclass classname="setScissor" name="setScissor" time="0.000">
</testclass>
<testclass classname="setShader" name="setShader" time="0.000">
</testclass>
<testclass classname="setStencilMode" name="setStencilMode" time="0.000">
</testclass>
<testclass classname="setWireframe" name="setWireframe" time="0.000">
</testclass>
<testclass classname="shear" name="shear" time="0.002">
</testclass>
<testclass classname="transformPoint" name="transformPoint" time="0.000">
</testclass>
<testclass classname="translate" name="translate" time="0.001">
</testclass>
<testclass classname="validateShader" name="validateShader" time="0.010">
</testclass>
</testsuite>
<testsuite name="love.image" tests="3" failures="0" skipped="0" time="0.002">
<testclass classname="isCompressed" name="isCompressed" time="0.001">
</testclass>
<testclass classname="newCompressedData" name="newCompressedData" time="0.001">
</testclass>
<testclass classname="newImageData" name="newImageData" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.math" tests="17" failures="0" skipped="0" time="0.003">
<testclass classname="colorFromBytes" name="colorFromBytes" time="0.000">
</testclass>
<testclass classname="colorToBytes" name="colorToBytes" time="0.001">
</testclass>
<testclass classname="gammaToLinear" name="gammaToLinear" time="0.000">
</testclass>
<testclass classname="getRandomSeed" name="getRandomSeed" time="0.000">
</testclass>
<testclass classname="getRandomState" name="getRandomState" time="0.000">
</testclass>
<testclass classname="isConvex" name="isConvex" time="0.000">
</testclass>
<testclass classname="linearToGamma" name="linearToGamma" time="0.000">
</testclass>
<testclass classname="newBezierCurve" name="newBezierCurve" time="0.000">
</testclass>
<testclass classname="newRandomGenerator" name="newRandomGenerator" time="0.000">
</testclass>
<testclass classname="newTransform" name="newTransform" time="0.000">
</testclass>
<testclass classname="perlinNoise" name="perlinNoise" time="0.000">
</testclass>
<testclass classname="random" name="random" time="0.000">
</testclass>
<testclass classname="randomNormal" name="randomNormal" time="0.000">
</testclass>
<testclass classname="setRandomSeed" name="setRandomSeed" time="0.000">
</testclass>
<testclass classname="setRandomState" name="setRandomState" time="0.000">
</testclass>
<testclass classname="simplexNoise" name="simplexNoise" time="0.000">
</testclass>
<testclass classname="triangulate" name="triangulate" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.objects" tests="1" failures="0" skipped="0" time="0.008">
<testclass classname="File" name="File" time="0.008">
</testclass>
</testsuite>
<testsuite name="love.physics" tests="22" failures="0" skipped="0" time="0.005">
<testclass classname="getDistance" name="getDistance" time="0.000">
</testclass>
<testclass classname="getMeter" name="getMeter" time="0.000">
</testclass>
<testclass classname="newBody" name="newBody" time="0.000">
</testclass>
<testclass classname="newChainShape" name="newChainShape" time="0.000">
</testclass>
<testclass classname="newCircleShape" name="newCircleShape" time="0.000">
</testclass>
<testclass classname="newDistanceJoint" name="newDistanceJoint" time="0.000">
</testclass>
<testclass classname="newEdgeShape" name="newEdgeShape" time="0.000">
</testclass>
<testclass classname="newFixture" name="newFixture" time="0.000">
</testclass>
<testclass classname="newFrictionJoint" name="newFrictionJoint" time="0.000">
</testclass>
<testclass classname="newGearJoint" name="newGearJoint" time="0.000">
</testclass>
<testclass classname="newMotorJoint" name="newMotorJoint" time="0.000">
</testclass>
<testclass classname="newMouseJoint" name="newMouseJoint" time="0.000">
</testclass>
<testclass classname="newPolygonShape" name="newPolygonShape" time="0.000">
</testclass>
<testclass classname="newPrismaticJoint" name="newPrismaticJoint" time="0.000">
</testclass>
<testclass classname="newPulleyJoint" name="newPulleyJoint" time="0.000">
</testclass>
<testclass classname="newRectangleShape" name="newRectangleShape" time="0.001">
</testclass>
<testclass classname="newRevoluteJoint" name="newRevoluteJoint" time="0.000">
</testclass>
<testclass classname="newRopeJoint" name="newRopeJoint" time="0.000">
</testclass>
<testclass classname="newWeldJoint" name="newWeldJoint" time="0.000">
</testclass>
<testclass classname="newWheelJoint" name="newWheelJoint" time="0.001">
</testclass>
<testclass classname="newWorld" name="newWorld" time="0.000">
</testclass>
<testclass classname="setMeter" name="setMeter" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.sound" tests="2" failures="0" skipped="0" time="0.004">
<testclass classname="newDecoder" name="newDecoder" time="0.001">
</testclass>
<testclass classname="newSoundData" name="newSoundData" time="0.003">
</testclass>
</testsuite>
<testsuite name="love.system" tests="6" failures="0" skipped="2" time="0.007">
<testclass classname="getClipboardText" name="getClipboardText" time="0.006">
</testclass>
<testclass classname="getOS" name="getOS" time="0.000">
</testclass>
<testclass classname="getPowerInfo" name="getPowerInfo" time="0.000">
</testclass>
<testclass classname="getProcessorCount" name="getProcessorCount" time="0.000">
</testclass>
<testclass classname="hasBackgroundMusic" name="hasBackgroundMusic" time="0.000">
</testclass>
<testclass classname="openURL" name="openURL" time="0.000">
</testclass>
<testclass classname="setClipboardText" name="setClipboardText" time="0.001">
</testclass>
<testclass classname="vibrate" name="vibrate" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.thread" tests="3" failures="0" skipped="0" time="0.002">
<testclass classname="getChannel" name="getChannel" time="0.000">
</testclass>
<testclass classname="newChannel" name="newChannel" time="0.000">
</testclass>
<testclass classname="newThread" name="newThread" time="0.001">
</testclass>
</testsuite>
<testsuite name="love.timer" tests="6" failures="0" skipped="0" time="2.002">
<testclass classname="getAverageDelta" name="getAverageDelta" time="0.000">
</testclass>
<testclass classname="getDelta" name="getDelta" time="0.000">
</testclass>
<testclass classname="getFPS" name="getFPS" time="0.000">
</testclass>
<testclass classname="getTime" name="getTime" time="1.001">
</testclass>
<testclass classname="sleep" name="sleep" time="1.001">
</testclass>
<testclass classname="step" name="step" time="0.000">
</testclass>
</testsuite>
<testsuite name="love.video" tests="1" failures="0" skipped="0" time="0.005">
<testclass classname="newVideoStream" name="newVideoStream" time="0.005">
</testclass>
</testsuite>
<testsuite name="love.window" tests="32" failures="2" skipped="2" time="5.419">
<testclass classname="close" name="close" time="0.037">
</testclass>
<testclass classname="fromPixels" name="fromPixels" time="0.000">
</testclass>
<testclass classname="getDPIScale" name="getDPIScale" time="0.000">
</testclass>
<testclass classname="getDesktopDimensions" name="getDesktopDimensions" time="0.000">
</testclass>
<testclass classname="getDisplayCount" name="getDisplayCount" time="0.000">
</testclass>
<testclass classname="getDisplayName" name="getDisplayName" time="0.000">
</testclass>
<testclass classname="getDisplayOrientation" name="getDisplayOrientation" time="0.000">
</testclass>
<testclass classname="getFullscreen" name="getFullscreen" time="1.347">
</testclass>
<testclass classname="getFullscreenModes" name="getFullscreenModes" time="0.001">
</testclass>
<testclass classname="getIcon" name="getIcon" time="0.004">
</testclass>
<testclass classname="getMode" name="getMode" time="0.000">
</testclass>
<testclass classname="getPosition" name="getPosition" time="0.001">
</testclass>
<testclass classname="getSafeArea" name="getSafeArea" time="0.000">
</testclass>
<testclass classname="getTitle" name="getTitle" time="0.001">
</testclass>
<testclass classname="getVSync" name="getVSync" time="0.000">
</testclass>
<testclass classname="hasFocus" name="hasFocus" time="0.000">
</testclass>
<testclass classname="hasMouseFocus" name="hasMouseFocus" time="0.000">
</testclass>
<testclass classname="isDisplaySleepEnabled" name="isDisplaySleepEnabled" time="0.000">
</testclass>
<testclass classname="isMaximized" name="isMaximized" time="0.640">
<failure message="assert #2 [check window not maximized] expected 'true' got 'false'"></failure>
</testclass>
<testclass classname="isMinimized" name="isMinimized" time="0.645">
</testclass>
<testclass classname="isOpen" name="isOpen" time="0.036">
</testclass>
<testclass classname="isVisible" name="isVisible" time="0.031">
</testclass>
<testclass classname="maximize" name="maximize" time="0.000">
<failure message="assert #1 [check window maximized] expected 'true' got 'false'"></failure>
</testclass>
<testclass classname="minimize" name="minimize" time="0.646">
</testclass>
<testclass classname="requestAttention" name="requestAttention" time="0.000">
</testclass>
<testclass classname="restore" name="restore" time="0.642">
</testclass>
<testclass classname="setDisplaySleepEnabled" name="setDisplaySleepEnabled" time="0.000">
</testclass>
<testclass classname="setFullscreen" name="setFullscreen" time="1.370">
</testclass>
<testclass classname="setIcon" name="setIcon" time="0.002">
</testclass>
<testclass classname="setMode" name="setMode" time="0.008">
</testclass>
<testclass classname="setPosition" name="setPosition" time="0.001">
</testclass>
<testclass classname="setTitle" name="setTitle" time="0.000">
</testclass>
<testclass classname="setVSync" name="setVSync" time="0.000">
</testclass>
<testclass classname="showMessageBox" name="showMessageBox" time="0.000">
</testclass>
<testclass classname="toPixels" name="toPixels" time="0.000">
</testclass>
<testclass classname="updateMode" name="updateMode" time="0.006">
</testclass>
</testsuite>
</testsuites>
+7 -1
View File
@@ -169,4 +169,10 @@ function UtilStringSplit(str, splitter)
table.insert(splits, word)
end
return splits
end
end
-- string time formatter
function UtilTimeFormat(seconds)
return string.format("%.3f", tostring(seconds))
end
File diff suppressed because one or more lines are too long
-385
View File
@@ -1,385 +0,0 @@
<testsuites name="love.test" tests="157" failures="5" skipped="11" time="7341.71">
<testsuite name="love.audio" tests="26" failures="0" skipped="0" time="0.40991666666712">
<testclass classname="getActiveEffects" name="getActiveEffects" time="0.045083333333418">
</testclass>
<testclass classname="getActiveSourceCount" name="getActiveSourceCount" time="1.1385">
</testclass>
<testclass classname="getDistanceModel" name="getDistanceModel" time="0.018125000000202">
</testclass>
<testclass classname="getDopplerScale" name="getDopplerScale" time="0.012208333333374">
</testclass>
<testclass classname="getEffect" name="getEffect" time="0.035250000000042">
</testclass>
<testclass classname="getMaxSceneEffects" name="getMaxSceneEffects" time="0.0089583333331422">
</testclass>
<testclass classname="getMaxSourceEffects" name="getMaxSourceEffects" time="0.022874999999978">
</testclass>
<testclass classname="getOrientation" name="getOrientation" time="0.037541666666696">
</testclass>
<testclass classname="getPosition" name="getPosition" time="0.024500000000316">
</testclass>
<testclass classname="getRecordingDevices" name="getRecordingDevices" time="0.039250000000157">
</testclass>
<testclass classname="getVelocity" name="getVelocity" time="0.021333333333207">
</testclass>
<testclass classname="getVolume" name="getVolume" time="0.046083333333335">
</testclass>
<testclass classname="isEffectsSupported" name="isEffectsSupported" time="0.016749999999899">
</testclass>
<testclass classname="newQueueableSource" name="newQueueableSource" time="0.041958333333314">
</testclass>
<testclass classname="newSource" name="newSource" time="2.8378333333332">
</testclass>
<testclass classname="pause" name="pause" time="2.6265416666664">
</testclass>
<testclass classname="play" name="play" time="1.7924166666665">
</testclass>
<testclass classname="setDistanceModel" name="setDistanceModel" time="0.023249999999919">
</testclass>
<testclass classname="setDopplerScale" name="setDopplerScale" time="0.094375000000646">
</testclass>
<testclass classname="setEffect" name="setEffect" time="0.024166666666936">
</testclass>
<testclass classname="setMixWithSystem" name="setMixWithSystem" time="0.0052083333330621">
</testclass>
<testclass classname="setOrientation" name="setOrientation" time="0.017000000000156">
</testclass>
<testclass classname="setPosition" name="setPosition" time="0.0091666666666157">
</testclass>
<testclass classname="setVelocity" name="setVelocity" time="0.0070416666657636">
</testclass>
<testclass classname="setVolume" name="setVolume" time="0.0075833333332831">
</testclass>
<testclass classname="stop" name="stop" time="1.787666666667">
</testclass>
</testsuite>
<testsuite name="love.data" tests="7" failures="0" skipped="3" time="0.34008333333449">
<testclass classname="compress" name="compress" time="0.39495833333403">
</testclass>
<testclass classname="decode" name="decode" time="0.027791666666666">
</testclass>
<testclass classname="decompress" name="decompress" time="0.28366666666635">
</testclass>
<testclass classname="encode" name="encode" time="0.044000000000377">
</testclass>
<testclass classname="getPackedSize" name="getPackedSize" time="0.0069999999996462">
</testclass>
<testclass classname="hash" name="hash" time="0.12045833333341">
</testclass>
<testclass classname="newByteData" name="newByteData" time="0.021916666666844">
</testclass>
<testclass classname="newDataView" name="newDataView" time="0.025416666666889">
</testclass>
<testclass classname="pack" name="pack" time="0.0070833333332132">
</testclass>
<testclass classname="unpack" name="unpack" time="0.0091250000000542">
</testclass>
</testsuite>
<testsuite name="love.event" tests="4" failures="0" skipped="2" time="0.47999999999884">
<testclass classname="clear" name="clear" time="0.028666666666233">
</testclass>
<testclass classname="poll" name="poll" time="0.022374999999464">
</testclass>
<testclass classname="pump" name="pump" time="0.0079583333327804">
</testclass>
<testclass classname="push" name="push" time="0.022500000000036">
</testclass>
<testclass classname="quit" name="quit" time="0.014125000000753">
</testclass>
<testclass classname="wait" name="wait" time="0.0069166666669673">
</testclass>
</testsuite>
<testsuite name="love.filesystem" tests="26" failures="1" skipped="2" time="1.0150000000023">
<testclass classname="append" name="append" time="1.3135833333333">
</testclass>
<testclass classname="areSymlinksEnabled" name="areSymlinksEnabled" time="0.01433333333356">
</testclass>
<testclass classname="createDirectory" name="createDirectory" time="0.39929166666663">
</testclass>
<testclass classname="getAppdataDirectory" name="getAppdataDirectory" time="0.014166666668203">
</testclass>
<testclass classname="getCRequirePath" name="getCRequirePath" time="0.015749999999315">
</testclass>
<testclass classname="getDirectoryItems" name="getDirectoryItems" time="1.0962083333332">
</testclass>
<testclass classname="getIdentity" name="getIdentity" time="0.10579166666691">
</testclass>
<testclass classname="getInfo" name="getInfo" time="0.9892916666665">
</testclass>
<testclass classname="getRealDirectory" name="getRealDirectory" time="0.98024999999957">
</testclass>
<testclass classname="getRequirePath" name="getRequirePath" time="0.097583333333873">
</testclass>
<testclass classname="getSaveDirectory" name="getSaveDirectory" time="0.01891666666598">
</testclass>
<testclass classname="getSource" name="getSource" time="0.020666666666003">
</testclass>
<testclass classname="getSourceBaseDirectory" name="getSourceBaseDirectory" time="0.015083333334331">
</testclass>
<testclass classname="getUserDirectory" name="getUserDirectory" time="0.043666666666553">
</testclass>
<testclass classname="getWorkingDirectory" name="getWorkingDirectory" time="0.018791666667184">
</testclass>
<testclass classname="isFused" name="isFused" time="0.017999999998963">
</testclass>
<testclass classname="lines" name="lines" time="13.630166666666">
</testclass>
<testclass classname="load" name="load" time="7.9870833333331">
</testclass>
<testclass classname="mount" name="mount" time="0.48216666666789">
</testclass>
<testclass classname="newFile" name="newFile" time="0.37395833333331">
<failure message="assert #2 [check file made] avoiding 'nil' got 'nil'"></failure>
</testclass>
<testclass classname="newFileData" name="newFileData" time="0.030666666666512">
</testclass>
<testclass classname="read" name="read" time="0.19545833333368">
</testclass>
<testclass classname="remove" name="remove" time="0.81487500000055">
</testclass>
<testclass classname="setCRequirePath" name="setCRequirePath" time="0.017416666667103">
</testclass>
<testclass classname="setIdentity" name="setIdentity" time="0.086666666666346">
</testclass>
<testclass classname="setRequirePath" name="setRequirePath" time="0.014500000001583">
</testclass>
<testclass classname="setSource" name="setSource" time="0.0082916666652721">
</testclass>
<testclass classname="unmount" name="unmount" time="1.1363333333341">
</testclass>
<testclass classname="write" name="write" time="1.0965416666666">
</testclass>
</testsuite>
<testsuite name="love.font" tests="4" failures="0" skipped="1" time="0.11233333333444">
<testclass classname="newBMFontRasterizer" name="newBMFontRasterizer" time="0.007625000002065">
</testclass>
<testclass classname="newGlyphData" name="newGlyphData" time="0.28787499999972">
</testclass>
<testclass classname="newImageRasterizer" name="newImageRasterizer" time="0.22408333333424">
</testclass>
<testclass classname="newRasterizer" name="newRasterizer" time="0.18954166666596">
</testclass>
<testclass classname="newTrueTypeRasterizer" name="newTrueTypeRasterizer" time="0.18991666666501">
</testclass>
</testsuite>
<testsuite name="love.graphics" tests="0" failures="1" skipped="0" time="0.94387500000009">
<testclass classname="rectangle" name="rectangle" time="3.7313333333344">
<failure message="assert #2 [check 0x,0y G] expected '1' got '0'"></failure>
</testclass>
</testsuite>
<testsuite name="love.image" tests="3" failures="0" skipped="0" time="1.2476249999999">
<testclass classname="isCompressed" name="isCompressed" time="0.21679166666644">
</testclass>
<testclass classname="newCompressedData" name="newCompressedData" time="0.19920833333309">
</testclass>
<testclass classname="newImageData" name="newImageData" time="0.40049999999958">
</testclass>
</testsuite>
<testsuite name="love.math" tests="16" failures="0" skipped="0" time="0.062999999998231">
<testclass classname="colorFromBytes" name="colorFromBytes" time="0.29325000000036">
</testclass>
<testclass classname="colorToBytes" name="colorToBytes" time="0.27899999999903">
</testclass>
<testclass classname="gammaToLinear" name="gammaToLinear" time="0.021624999998693">
</testclass>
<testclass classname="getRandomSeed" name="getRandomSeed" time="0.014708333333502">
</testclass>
<testclass classname="getRandomState" name="getRandomState" time="0.071791666666599">
</testclass>
<testclass classname="isConvex" name="isConvex" time="0.056666666665706">
</testclass>
<testclass classname="linearToGamma" name="linearToGamma" time="0.01791666666584">
</testclass>
<testclass classname="newBezierCurve" name="newBezierCurve" time="0.053125000000875">
</testclass>
<testclass classname="newRandomGenerator" name="newRandomGenerator" time="0.019874999999558">
</testclass>
<testclass classname="newTransform" name="newTransform" time="0.02287499999909">
</testclass>
<testclass classname="noise" name="noise" time="0.076916666666094">
</testclass>
<testclass classname="random" name="random" time="0.17783333333377">
</testclass>
<testclass classname="randomNormal" name="randomNormal" time="0.020458333334972">
</testclass>
<testclass classname="setRandomSeed" name="setRandomSeed" time="0.019541666667067">
</testclass>
<testclass classname="setRandomState" name="setRandomState" time="0.053750000001074">
</testclass>
<testclass classname="triangulate" name="triangulate" time="0.023874999998341">
</testclass>
</testsuite>
<testsuite name="love.objects" tests="0" failures="0" skipped="0" time="1.6546249999983">
</testsuite>
<testsuite name="love.physics" tests="21" failures="1" skipped="0" time="0.014583333332624">
<testclass classname="getDistance" name="getDistance" time="0.075333333334981">
</testclass>
<testclass classname="getMeter" name="getMeter" time="0.015125000000893">
</testclass>
<testclass classname="newBody" name="newBody" time="0.03362500000037">
</testclass>
<testclass classname="newChainShape" name="newChainShape" time="0.028624999998783">
</testclass>
<testclass classname="newCircleShape" name="newCircleShape" time="0.020624999999441">
</testclass>
<testclass classname="newDistanceJoint" name="newDistanceJoint" time="0.037833333333737">
</testclass>
<testclass classname="newEdgeShape" name="newEdgeShape" time="0.020624999999441">
</testclass>
<testclass classname="newFixture" name="newFixture" time="0.077750000000876">
</testclass>
<testclass classname="newFrictionJoint" name="newFrictionJoint" time="0.031708333333214">
</testclass>
<testclass classname="newGearJoint" name="newGearJoint" time="0.12670833333139">
<failure message="test tests/physics.lua:134: Box2D assertion failed: m_bodyA->m_type == b2_dynamicBody"></failure>
</testclass>
<testclass classname="newMotorJoint" name="newMotorJoint" time="0.092416666667816">
</testclass>
<testclass classname="newMouseJoint" name="newMouseJoint" time="0.050208333334467">
</testclass>
<testclass classname="newPolygonShape" name="newPolygonShape" time="0.025333333333322">
</testclass>
<testclass classname="newPrismaticJoint" name="newPrismaticJoint" time="0.034124999999108">
</testclass>
<testclass classname="newPulleyJoint" name="newPulleyJoint" time="0.035041666665236">
</testclass>
<testclass classname="newRectangleShape" name="newRectangleShape" time="0.077833333332222">
</testclass>
<testclass classname="newRevoluteJoint" name="newRevoluteJoint" time="0.040416666667653">
</testclass>
<testclass classname="newRopeJoint" name="newRopeJoint" time="0.03037500000147">
</testclass>
<testclass classname="newWeldJoint" name="newWeldJoint" time="0.074916666664038">
</testclass>
<testclass classname="newWheelJoint" name="newWheelJoint" time="0.1102083333322">
</testclass>
<testclass classname="newWorld" name="newWorld" time="0.075416666666328">
</testclass>
<testclass classname="setMeter" name="setMeter" time="0.031208333336252">
</testclass>
</testsuite>
<testsuite name="love.sound" tests="2" failures="0" skipped="0" time="0.93524999999842">
<testclass classname="newDecoder" name="newDecoder" time="0.31383333333501">
</testclass>
<testclass classname="newSoundData" name="newSoundData" time="1.1787083333292">
</testclass>
</testsuite>
<testsuite name="love.system" tests="6" failures="0" skipped="2" time="1.3057500000059">
<testclass classname="getClipboardText" name="getClipboardText" time="1.6217916666665">
</testclass>
<testclass classname="getOS" name="getOS" time="0.034041666669538">
</testclass>
<testclass classname="getPowerInfo" name="getPowerInfo" time="0.080041666665309">
</testclass>
<testclass classname="getProcessorCount" name="getProcessorCount" time="0.017791666669709">
</testclass>
<testclass classname="hasBackgroundMusic" name="hasBackgroundMusic" time="0.086708333334684">
</testclass>
<testclass classname="openURL" name="openURL" time="0.016333333334728">
</testclass>
<testclass classname="setClipboardText" name="setClipboardText" time="0.59291666666716">
</testclass>
<testclass classname="vibrate" name="vibrate" time="0.0090416666651549">
</testclass>
</testsuite>
<testsuite name="love.thread" tests="3" failures="0" skipped="0" time="0.96195833333323">
<testclass classname="getChannel" name="getChannel" time="0.47320833333231">
</testclass>
<testclass classname="newChannel" name="newChannel" time="0.028374999999414">
</testclass>
<testclass classname="newThread" name="newThread" time="0.2556250000012">
</testclass>
</testsuite>
<testsuite name="love.timer" tests="6" failures="0" skipped="0" time="3713.5796666667">
<testclass classname="getAverageDelta" name="getAverageDelta" time="0.023208333331581">
</testclass>
<testclass classname="getDelta" name="getDelta" time="0.015708333332753">
</testclass>
<testclass classname="getFPS" name="getFPS" time="0.011125000000334">
</testclass>
<testclass classname="getTime" name="getTime" time="1001.1531666667">
</testclass>
<testclass classname="sleep" name="sleep" time="1000.4330833333">
</testclass>
<testclass classname="step" name="step" time="0.032958333331834">
</testclass>
</testsuite>
<testsuite name="love.video" tests="1" failures="0" skipped="0" time="0.67754166666772">
<testclass classname="newVideoStream" name="newVideoStream" time="3.4201249999981">
</testclass>
</testsuite>
<testsuite name="love.window" tests="32" failures="2" skipped="1" time="7985.3964583333">
<testclass classname="close" name="close" time="11.641583333336">
</testclass>
<testclass classname="fromPixels" name="fromPixels" time="0.015333333330148">
</testclass>
<testclass classname="getDPIScale" name="getDPIScale" time="0.014499999998918">
</testclass>
<testclass classname="getDesktopDimensions" name="getDesktopDimensions" time="0.015083333330779">
</testclass>
<testclass classname="getDisplayCount" name="getDisplayCount" time="0.010291666665552">
</testclass>
<testclass classname="getDisplayName" name="getDisplayName" time="0.014875000001524">
</testclass>
<testclass classname="getDisplayOrientation" name="getDisplayOrientation" time="0.016250000001605">
</testclass>
<testclass classname="getFullscreen" name="getFullscreen" time="1305.7451666667">
</testclass>
<testclass classname="getFullscreenModes" name="getFullscreenModes" time="0.48033333332853">
</testclass>
<testclass classname="getIcon" name="getIcon" time="2.0577083333322">
</testclass>
<testclass classname="getMode" name="getMode" time="0.10416666667012">
</testclass>
<testclass classname="getPosition" name="getPosition" time="4.9660833333327">
</testclass>
<testclass classname="getSafeArea" name="getSafeArea" time="0.067875000002715">
</testclass>
<testclass classname="getTitle" name="getTitle" time="0.55745833333276">
</testclass>
<testclass classname="getVSync" name="getVSync" time="0.095124999997864">
</testclass>
<testclass classname="hasFocus" name="hasFocus" time="0.055624999998116">
</testclass>
<testclass classname="hasMouseFocus" name="hasMouseFocus" time="0.022541666666598">
</testclass>
<testclass classname="isDisplaySleepEnabled" name="isDisplaySleepEnabled" time="0.14775000000355">
</testclass>
<testclass classname="isMaximized" name="isMaximized" time="642.02083333333">
<failure message="assert #2 [check window not maximized] expected 'true' got 'false'"></failure>
</testclass>
<testclass classname="isMinimized" name="isMinimized" time="641.41475">
</testclass>
<testclass classname="isOpen" name="isOpen" time="25.519625000001">
</testclass>
<testclass classname="isVisible" name="isVisible" time="18.191791666666">
</testclass>
<testclass classname="maximize" name="maximize" time="0.23570833333508">
<failure message="assert #1 [check window maximized] expected 'true' got 'false'"></failure>
</testclass>
<testclass classname="minimize" name="minimize" time="640.26066666666">
</testclass>
<testclass classname="restore" name="restore" time="643.01916666667">
</testclass>
<testclass classname="setDisplaySleepEnabled" name="setDisplaySleepEnabled" time="0.59508333333014">
</testclass>
<testclass classname="setFullscreen" name="setFullscreen" time="1329.778375">
</testclass>
<testclass classname="setIcon" name="setIcon" time="2.0223750000028">
</testclass>
<testclass classname="setMode" name="setMode" time="4.5707499999992">
</testclass>
<testclass classname="setPosition" name="setPosition" time="0.16512499999521">
</testclass>
<testclass classname="setTitle" name="setTitle" time="0.47262500000045">
</testclass>
<testclass classname="setVSync" name="setVSync" time="0.022583333333159">
</testclass>
<testclass classname="showMessageBox" name="showMessageBox" time="0.068958333333313">
</testclass>
<testclass classname="toPixels" name="toPixels" time="0.067666666666355">
</testclass>
<testclass classname="updateMode" name="updateMode" time="6.8227083333348">
</testclass>
</testsuite>
</testsuites>
+14 -18
View File
@@ -84,19 +84,22 @@ This is the status of all module tests currently.
-- [x] audio 26 PASSED | 0 FAILED | 0 SKIPPED
-- [x] data 7 PASSED | 0 FAILED | 3 SKIPPED [SEE BELOW]
-- [x] event 4 PASSED | 0 FAILED | 2 SKIPPED [SEE BELOW]
-- [x] filesystem 26 PASSED | 1 FAILED | 2 SKIPPED [SEE BELOW]
-- [x] filesystem 27 PASSED | 0 FAILED | 2 SKIPPED
-- [x] font 4 PASSED | 0 FAILED | 1 SKIPPED [SEE BELOW]
-- [ ] graphics STILL TO BE DONE
-- [ ] graphics 65 PASSED | 0 FAILED | 31 SKIPPED [SEE BELOW]
-- [x] image 3 PASSED | 0 FAILED | 0 SKIPPED
-- [x] math 16 PASSED | 0 FAILED | 0 SKIPPED [SEE BELOW]
-- [x] physics 21 PASSED | 1 FAILED | 0 SKIPPED [SEE BELOW]
-- [x] math 17 PASSED | 0 FAILED | 0 SKIPPED
-- [x] physics 22 PASSED | 0 FAILED | 0 SKIPPED
-- [x] sound 2 PASSED | 0 FAILED | 0 SKIPPED
-- [x] system 7 PASSED | 0 FAILED | 1 SKIPPED
-- [ ] thread 3 PASSED | 0 FAILED | 0 SKIPPED
-- [x] timer 6 PASSED | 0 FAILED | 0 SKIPPED [SEE BELOW]
-- [x] system 6 PASSED | 0 FAILED | 2 SKIPPED
-- [x] thread 3 PASSED | 0 FAILED | 0 SKIPPED
-- [x] timer 6 PASSED | 0 FAILED | 0 SKIPPED
-- [x] video 1 PASSED | 0 FAILED | 0 SKIPPED
-- [x] window 32 PASSED | 2 FAILED | 1 SKIPPED [SEE BELOW]
-- [x] window 32 PASSED | 2 FAILED | 2 SKIPPED [SEE BELOW]
-- [ ] objects STILL TO BE DONE
--------------------------------------------------------------------------------
-- [x] totals 226 PASSED | 4 FAILED | 43 SKIPPED
```
The following modules are not covered as we can't really emulate input nicely:
@@ -108,24 +111,17 @@ The following modules are not covered as we can't really emulate input nicely:
Modules with some small bits needed or needing sense checking:
- **love.data** - packing methods need writing cos i dont really get what they are
- **love.event** - love.event.wait or love.event.pump need writing if possible I dunno how to check
- **love.filesystem** - getSource() / setSource() dont think we can test
- **love.font** - newBMFontRasterizer() wiki entry is wrong so not sure whats expected
- **love.timer** - couple methods I don't know if you could reliably test specific values
- **love.graphics** - still need to do tests for the drawing and state methods
- **love.image** - ideally isCompressed should have an example of all compressed files love can take
- **love.math** - linearToGamma + gammaToLinear using direct formulas don't get same value back
- **love.window** - couple stuff just nil checked as I think it's hardware dependent, needs checking
Modules still to be completed or barely started
- **love.graphics** - done 1 as an example of how we can test the drawing but not really started
- **love.objects** - done 1 as an example of how we can test objs with mini scenarios
- **love.objects** - not started properly yet
---
## Failures
- **love.window.isMaximized()** - returns false after calling love.window.maximize?
- **love.window.maximize()** - same as above
- **love.physics.newGearJoint()** - something changed in 12
- **love.objects.File()** - dont think I understand the buffering system
---
@@ -136,4 +132,4 @@ Modules still to be completed or barely started
- [ ] Ability to test loading different combinations of modules
- [ ] Performance tests
There is some unused code in the Test.lua class to add preview vs actual images to the HTML output
There is some unused code in the Test.lua class to add preview vs actual images to the HTML output
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

+47 -62
View File
@@ -3,9 +3,9 @@
-- love.audio.getActiveEffects
love.test.audio.getActiveEffects = function(test)
-- tests
test:assertNotEquals(nil, love.audio.getActiveEffects(), 'check not nil')
test:assertEquals(0, #love.audio.getActiveEffects(), 'check no effects running')
-- check we get a value
test:assertNotNil(love.audio.getActiveEffects())
-- check setting an effect active
love.audio.setEffect('testeffect', {
type = 'chorus',
volume = 10
@@ -17,23 +17,25 @@ end
-- love.audio.getActiveSourceCount
love.test.audio.getActiveSourceCount = function(test)
-- tests
test:assertNotEquals(nil, love.audio.getActiveSourceCount(), 'check not nil')
test:assertEquals(0, love.audio.getActiveSourceCount(), 'check 0 by default')
-- check we get a value
test:assertNotNil(love.audio.getActiveSourceCount())
-- check source isn't active by default
local testsource = love.audio.newSource('resources/click.ogg', 'static')
test:assertEquals(0, love.audio.getActiveSourceCount(), 'check not active')
-- check playing a source marks it as active
love.audio.play(testsource)
test:assertEquals(1, love.audio.getActiveSourceCount(), 'check now active')
love.audio.pause()
testsource:release()
end
-- love.audio.getDistanceModel
love.test.audio.getDistanceModel = function(test)
-- tests
test:assertNotEquals(nil, love.audio.getDistanceModel(), 'check not nil')
-- check we get a value
test:assertNotNil(love.audio.getDistanceModel())
-- check default value from documentation
test:assertEquals('inverseclamped', love.audio.getDistanceModel(), 'check default value')
-- check get correct value after setting
love.audio.setDistanceModel('inverse')
test:assertEquals('inverse', love.audio.getDistanceModel(), 'check setting model')
end
@@ -41,7 +43,9 @@ end
-- love.audio.getDopplerScale
love.test.audio.getDopplerScale = function(test)
-- check default value
test:assertEquals(1, love.audio.getDopplerScale(), 'check default 1')
-- check correct value after setting to 0
love.audio.setDopplerScale(0)
test:assertEquals(0, love.audio.getDopplerScale(), 'check setting to 0')
love.audio.setDopplerScale(1)
@@ -50,14 +54,15 @@ end
-- love.audio.getEffect
love.test.audio.getEffect = function(test)
-- setup
-- check getting a non-existent effect
test:assertEquals(nil, love.audio.getEffect('madeupname'), 'check wrong name')
-- check getting a valid effect
love.audio.setEffect('testeffect', {
type = 'chorus',
volume = 10
})
-- tests
test:assertEquals(nil, love.audio.getEffect('madeupname'), 'check wrong name')
test:assertNotEquals(nil, love.audio.getEffect('testeffect'), 'check not nil')
test:assertNotNil(love.audio.getEffect('testeffect'))
-- check effect values match creation values
test:assertEquals('chorus', love.audio.getEffect('testeffect').type, 'check effect type')
test:assertEquals(10, love.audio.getEffect('testeffect').volume, 'check effect volume')
end
@@ -66,23 +71,22 @@ end
-- love.audio.getMaxSceneEffects
-- @NOTE feel like this is platform specific number so best we can do is a nil?
love.test.audio.getMaxSceneEffects = function(test)
test:assertNotEquals(nil, love.audio.getMaxSceneEffects(), 'check not nil')
test:assertNotNil(love.audio.getMaxSceneEffects())
end
-- love.audio.getMaxSourceEffects
-- @NOTE feel like this is platform specific number so best we can do is a nil?
love.test.audio.getMaxSourceEffects = function(test)
test:assertNotEquals(nil, love.audio.getMaxSourceEffects(), 'check not nil')
test:assertNotNil(love.audio.getMaxSourceEffects())
end
-- love.audio.getOrientation
-- @NOTE is there an expected default listener pos?
love.test.audio.getOrientation = function(test)
-- setup
-- checking getting values matches what was set
love.audio.setOrientation(1, 2, 3, 4, 5, 6)
-- tests
local fx, fy, fz, ux, uy, uz = love.audio.getOrientation()
test:assertEquals(1, fx, 'check fx orientation')
test:assertEquals(2, fy, 'check fy orientation')
@@ -96,9 +100,8 @@ end
-- love.audio.getPosition
-- @NOTE is there an expected default listener pos?
love.test.audio.getPosition = function(test)
-- setup
-- check getting values matches what was set
love.audio.setPosition(1, 2, 3)
-- tests
local x, y, z = love.audio.getPosition()
test:assertEquals(1, x, 'check x position')
test:assertEquals(2, y, 'check y position')
@@ -107,16 +110,16 @@ end
-- love.audio.getRecordingDevices
-- @NOTE hardware dependent so best can do is not nil check
love.test.audio.getRecordingDevices = function(test)
test:assertNotEquals(nil, love.audio.getRecordingDevices(), 'check not nil')
test:assertNotNil(love.audio.getRecordingDevices())
end
-- love.audio.getVelocity
love.test.audio.getVelocity = function(test)
-- setup
-- check getting values matches what was set
love.audio.setVelocity(1, 2, 3)
-- tests
local x, y, z = love.audio.getVelocity()
test:assertEquals(1, x, 'check x velocity')
test:assertEquals(2, y, 'check y velocity')
@@ -126,87 +129,74 @@ end
-- love.audio.getVolume
love.test.audio.getVolume = function(test)
-- setup
-- check getting values matches what was set
love.audio.setVolume(0.5)
-- tests
test:assertNotEquals(nil, love.audio.getVolume(), 'check not nil')
test:assertEquals(0.5, love.audio.getVolume(), 'check matches set')
end
-- love.audio.isEffectsSupported
love.test.audio.isEffectsSupported = function(test)
test:assertNotEquals(nil, love.audio.isEffectsSupported(), 'check not nil')
test:assertNotNil(love.audio.isEffectsSupported())
end
-- love.audio.newQueueableSource
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.audio.newQueueableSource = function(test)
local source = love.audio.newQueueableSource(32, 8, 1, 8)
test:assertObject(source)
source:release()
test:assertObject(love.audio.newQueueableSource(32, 8, 1, 8))
end
-- love.audio.newSource
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.audio.newSource = function(test)
-- setup
local source1 = love.audio.newSource('resources/click.ogg', 'static')
local source2 = love.audio.newSource('resources/click.ogg', 'stream')
-- tests
test:assertObject(source1)
test:assertObject(source2)
-- cleanup
source1:release()
source2:release()
test:assertObject(love.audio.newSource('resources/click.ogg', 'static'))
test:assertObject(love.audio.newSource('resources/click.ogg', 'stream'))
end
-- love.audio.pause
love.test.audio.pause = function(test)
-- tests
-- check nothing paused (as should be nothing playing)
local nopauses = love.audio.pause()
test:assertNotEquals(nil, nopauses, 'check not nil')
test:assertEquals(0, #nopauses, 'check nothing paused')
-- check 1 source paused after playing/pausing 1
local source = love.audio.newSource('resources/click.ogg', 'static')
love.audio.play(source)
local onepause = love.audio.pause()
test:assertEquals(1, #onepause, 'check 1 paused')
source:release()
end
-- love.audio.play
love.test.audio.play = function(test)
-- setup
-- check playing source is detected
local source = love.audio.newSource('resources/click.ogg', 'static')
-- tests
love.audio.play(source)
test:assertEquals(true, source:isPlaying(), 'check something playing')
love.audio.pause()
source:release()
end
-- love.audio.setDistanceModel
love.test.audio.setDistanceModel = function(test)
-- tests
-- check setting each of the distance models is accepted and val returned
local distancemodel = {
'none', 'inverse', 'inverseclamped', 'linear', 'linearclamped',
'exponent', 'exponentclamped'
}
for d=1,#distancemodel do
love.audio.setDistanceModel(distancemodel[d])
test:assertEquals(distancemodel[d], love.audio.getDistanceModel(), 'check model set to ' .. distancemodel[d])
test:assertEquals(distancemodel[d], love.audio.getDistanceModel(),
'check model set to ' .. distancemodel[d])
end
end
-- love.audio.setDopplerScale
love.test.audio.setDopplerScale = function(test)
-- tests
-- check setting value is returned properly
love.audio.setDopplerScale(0)
test:assertEquals(0, love.audio.getDopplerScale(), 'check set to 0')
love.audio.setDopplerScale(1)
@@ -216,12 +206,13 @@ end
-- love.audio.setEffect
love.test.audio.setEffect = function(test)
-- tests
-- check effect is set correctly
local effect = love.audio.setEffect('testeffect', {
type = 'chorus',
volume = 10
})
test:assertEquals(true, effect, 'check effect created')
-- check values set match
local settings = love.audio.getEffect('testeffect')
test:assertEquals('chorus', settings.type, 'check effect type')
test:assertEquals(10, settings.volume, 'check effect volume')
@@ -230,15 +221,14 @@ end
-- love.audio.setMixWithSystem
love.test.audio.setMixWithSystem = function(test)
test:assertNotEquals(nil, love.audio.setMixWithSystem(true), 'check not nil')
test:assertNotNil(love.audio.setMixWithSystem(true))
end
-- love.audio.setOrientation
love.test.audio.setOrientation = function(test)
-- setup
-- check setting orientation vals are returned
love.audio.setOrientation(1, 2, 3, 4, 5, 6)
-- tests
local fx, fy, fz, ux, uy, uz = love.audio.getOrientation()
test:assertEquals(1, fx, 'check fx orientation')
test:assertEquals(2, fy, 'check fy orientation')
@@ -251,9 +241,8 @@ end
-- love.audio.setPosition
love.test.audio.setPosition = function(test)
-- setup
-- check setting position vals are returned
love.audio.setPosition(1, 2, 3)
-- tests
local x, y, z = love.audio.getPosition()
test:assertEquals(1, x, 'check x position')
test:assertEquals(2, y, 'check y position')
@@ -263,9 +252,8 @@ end
-- love.audio.setVelocity
love.test.audio.setVelocity = function(test)
-- setup
-- check setting velocity vals are returned
love.audio.setVelocity(1, 2, 3)
-- tests
local x, y, z = love.audio.getVelocity()
test:assertEquals(1, x, 'check x velocity')
test:assertEquals(2, y, 'check y velocity')
@@ -275,22 +263,19 @@ end
-- love.audio.setVolume
love.test.audio.setVolume = function(test)
-- setup
-- check setting volume works
love.audio.setVolume(0.5)
-- tests
test:assertNotEquals(nil, love.audio.getVolume(), 'check not nil')
test:assertEquals(0.5, love.audio.getVolume(), 'check set to 0.5')
end
-- love.audio.stop
love.test.audio.stop = function(test)
-- setup
-- check source is playing first
local source = love.audio.newSource('resources/click.ogg', 'static')
love.audio.play(source)
-- tests
test:assertEquals(true, source:isPlaying(), 'check is playing')
-- check source is then stopped
love.audio.stop()
test:assertEquals(false, source:isPlaying(), 'check stopped playing')
source:release()
end
end
+19 -29
View File
@@ -3,9 +3,8 @@
-- love.data.compress
love.test.data.compress = function(test)
-- here just testing each combo 'works', in decompress's test method
-- here just testing each combo 'works' - in decompress's test method
-- we actually check the compress + decompress give the right value back
-- setup
local compressions = {
{ love.data.compress('string', 'lz4', 'helloworld', -1), 'string'},
{ love.data.compress('string', 'lz4', 'helloworld', 0), 'string'},
@@ -26,9 +25,8 @@ love.test.data.compress = function(test)
{ love.data.compress('data', 'gzip', 'helloworld', 0), 'userdata'},
{ love.data.compress('data', 'gzip', 'helloworld', 9), 'userdata'}
}
-- tests
for c=1,#compressions do
test:assertNotEquals(nil, compressions[c][1], 'check not nil')
test:assertNotNil(compressions[c][1])
-- sense check return type and make sure bytedata returns are an object
test:assertEquals(compressions[c][2], type(compressions[c][1]), 'check is userdata')
if compressions[c][2] == 'userdata' then
@@ -40,12 +38,12 @@ end
-- love.data.decode
love.test.data.decode = function(test)
-- setup
-- setup encoded strings
local str1 = love.data.encode('string', 'base64', 'helloworld', 0)
local str2 = love.data.encode('string', 'hex', 'helloworld')
local str3 = love.data.encode('data', 'base64', 'helloworld', 0)
local str4 = love.data.encode('data', 'hex', 'helloworld')
-- tests
-- check value matches expected when decoded back
test:assertEquals('helloworld', love.data.decode('string', 'base64', str1), 'check string base64 decode')
test:assertEquals('helloworld', love.data.decode('string', 'hex', str2), 'check string hex decode')
test:assertEquals(love.data.newByteData('helloworld'):getString(), love.data.decode('data', 'base64', str3):getString(), 'check data base64 decode')
@@ -55,7 +53,7 @@ end
-- love.data.decompress
love.test.data.decompress = function(test)
-- setup
-- setup compressed data for each combination
local str1 = love.data.compress('string', 'lz4', 'helloworld', -1)
local str2 = love.data.compress('string', 'lz4', 'helloworld', 0)
local str3 = love.data.compress('string', 'lz4', 'helloworld', 9)
@@ -74,7 +72,7 @@ love.test.data.decompress = function(test)
local str16 = love.data.compress('data', 'gzip', 'helloworld', -1)
local str17 = love.data.compress('data', 'gzip', 'helloworld', 0)
local str18 = love.data.compress('data', 'gzip', 'helloworld', 9)
-- tests
-- check decompressed value matches whats expected
test:assertEquals('helloworld', love.data.decompress('string', 'lz4', str1), 'check string lz4 decompress')
test:assertEquals('helloworld', love.data.decompress('string', 'lz4', str2), 'check string lz4 decompress')
test:assertEquals('helloworld', love.data.decompress('string', 'lz4', str3), 'check string lz4 decompress')
@@ -98,9 +96,8 @@ end
-- love.data.encode
love.test.data.encode = function(test)
-- here just testing each combo 'works', in decode's test method
-- here just testing each combo 'works' - in decode's test method
-- we actually check the encode + decode give the right value back
-- setup
local encodes = {
{ love.data.encode('string', 'base64', 'helloworld', 0), 'string'},
{ love.data.encode('string', 'base64', 'helloworld', 2), 'string'},
@@ -109,9 +106,8 @@ love.test.data.encode = function(test)
{ love.data.encode('data', 'base64', 'helloworld', 2), 'userdata'},
{ love.data.encode('data', 'hex', 'helloworld'), 'userdata'}
}
-- tests
for e=1,#encodes do
test:assertNotEquals(nil, encodes[e][1], 'check not nil')
test:assertNotNil(encodes[e][1])
-- sense check return type and make sure bytedata returns are an object
test:assertEquals(encodes[e][2], type(encodes[e][1]), 'check is usedata')
if encodes[e][2] == 'userdata' then
@@ -123,22 +119,22 @@ end
-- love.data.getPackedSize
-- @NOTE I dont really get the packing types of lua so best someone else writes this one
-- @NOTE I don't really get what lua packing types are so skipping for now - ell
love.test.data.getPackedSize = function(test)
test:skipTest('dont understand lua packing types')
test:skipTest('test method needs writing')
end
-- love.data.hash
love.test.data.hash = function(test)
-- setup
-- setup all the different hashing types
local str1 = love.data.hash('md5', 'helloworld')
local str2 = love.data.hash('sha1', 'helloworld')
local str3 = love.data.hash('sha224', 'helloworld')
local str4 = love.data.hash('sha256', 'helloworld')
local str5 = love.data.hash('sha384', 'helloworld')
local str6 = love.data.hash('sha512', 'helloworld')
-- tests
-- check encoded hash value matches what's expected for that algo
test:assertEquals('fc5e038d38a57032085441e7fe7010b0', love.data.encode("string", "hex", str1), 'check md5 encode')
test:assertEquals('6adfb183a4a2c94a2f92dab5ade762a47889a5a1', love.data.encode("string", "hex", str2), 'check sha1 encode')
test:assertEquals('b033d770602994efa135c5248af300d81567ad5b59cec4bccbf15bcc', love.data.encode("string", "hex", str3), 'check sha224 encode')
@@ -151,32 +147,26 @@ end
-- love.data.newByteData
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.data.newByteData = function(test)
-- setup
local bytedata = love.data.newByteData('helloworld')
-- tests
test:assertObject(bytedata)
test:assertObject(love.data.newByteData('helloworld'))
end
-- love.data.newDataView
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.data.newDataView = function(test)
-- setup
local dataview = love.data.newDataView(love.data.newByteData('helloworld'), 0, 10)
-- tests
test:assertObject(dataview)
test:assertObject(love.data.newDataView(love.data.newByteData('helloworld'), 0, 10))
end
-- love.data.pack
-- @NOTE i dont really get the packing types of lua so best someone else writes this one
-- @NOTE I don't really get what lua packing types are so skipping for now - ell
love.test.data.pack = function(test)
test:skipTest('dont understand lua packing types')
test:skipTest('test method needs writing')
end
-- love.data.unpack
-- @NOTE i dont really get the packing types of lua so best someone else writes this one
-- @NOTE I don't really get what lua packing types are so skipping for now - ell
love.test.data.unpack = function(test)
test:skipTest('dont understand lua packing types')
end
test:skipTest('test method needs writing')
end
+11 -11
View File
@@ -3,11 +3,11 @@
-- love.event.clear
love.test.event.clear = function(test)
-- setup
-- push some events first
love.event.push('test', 1, 2, 3)
love.event.push('test', 1, 2, 3)
love.event.push('test', 1, 2, 3)
-- tests
-- check after calling clear there are no events left
love.event.clear()
local count = 0
for n, a, b, c, d, e, f in love.event.poll() do
@@ -19,11 +19,11 @@ end
-- love.event.poll
love.test.event.poll = function(test)
-- setup
-- push some events first
love.event.push('test', 1, 2, 3)
love.event.push('test', 1, 2, 3)
love.event.push('test', 1, 2, 3)
-- tests
-- check poll recieves all events
local count = 0
for n, a, b, c, d, e, f in love.event.poll() do
count = count + 1
@@ -33,15 +33,15 @@ end
-- love.event.pump
-- @NOTE dont think can really test as internal?
-- @NOTE dont think can really test as internally used
love.test.event.pump = function(test)
test:skipTest('not sure we can test when its internal?')
test:skipTest('not sure can be tested as used internally')
end
-- love.event.push
love.test.event.push = function(test)
-- test
-- check pushing some different types
love.event.push('add', 1, 2, 3)
love.event.push('ignore', 1, 2, 3)
love.event.push('add', 1, 2, 3)
@@ -58,10 +58,10 @@ end
-- love.event.quit
love.test.event.quit = function(test)
-- setting this overrides the quit hook to prevent actually quitting
love.test.module.fakequit = true
-- this should call love.quit, which will prevent the quit
-- if this fails then the test would just abort here
love.event.quit(0)
-- if it failed we'd have quit here
test:assertEquals(true, true, 'check quit hook called')
end
@@ -69,5 +69,5 @@ end
-- love.event.wait
-- @NOTE not sure best way to test this one
love.test.event.wait = function(test)
test:skipTest('not sure on best way to test this')
end
test:skipTest('test method needs writing')
end
+56 -65
View File
@@ -3,15 +3,16 @@
-- love.filesystem.append
love.test.filesystem.append = function(test)
-- setup
-- create a new file to test with
love.filesystem.write('filesystem.append.txt', 'foo')
-- test
-- try appending text and check new file contents/size matches
local success, message = love.filesystem.append('filesystem.append.txt', 'bar')
test:assertNotEquals(false, success, 'check success')
test:assertEquals(nil, message, 'check no error msg')
local contents, size = love.filesystem.read('filesystem.append.txt')
test:assertEquals(contents, 'foobar', 'check file contents')
test:assertEquals(size, 6, 'check file size')
-- check appending a specific no. of bytes
love.filesystem.append('filesystem.append.txt', 'foobarfoobarfoo', 6)
contents, size = love.filesystem.read('filesystem.append.txt')
test:assertEquals(contents, 'foobarfoobar', 'check appended contents')
@@ -22,14 +23,15 @@ end
-- love.filesystem.areSymlinksEnabled
-- @NOTE this one, need to see if default val is consistent on platforms?
-- @NOTE best can do here is just check not nil
love.test.filesystem.areSymlinksEnabled = function(test)
test:assertNotEquals(nil, love.filesystem.areSymlinksEnabled())
test:assertNotNil(love.filesystem.areSymlinksEnabled())
end
-- love.filesystem.createDirectory
love.test.filesystem.createDirectory = function(test)
-- 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')
@@ -43,23 +45,24 @@ end
-- love.filesystem.getAppdataDirectory
-- @NOTE i think this is too platform dependent to be tested nicely
love.test.filesystem.getAppdataDirectory = function(test)
test:assertNotEquals(nil, love.filesystem.getAppdataDirectory(), 'check not nill')
test:assertNotNil(love.filesystem.getAppdataDirectory())
end
-- love.filesystem.getCRequirePath
love.test.filesystem.getCRequirePath = function(test)
-- check default value from documentation
test:assertEquals('??', love.filesystem.getCRequirePath(), 'check default value')
end
-- love.filesystem.getDirectoryItems
love.test.filesystem.getDirectoryItems = function(test)
-- setup
-- create a dir + subdir with 2 files
love.filesystem.createDirectory('foo/bar')
love.filesystem.write('foo/file1.txt', 'file1')
love.filesystem.write('foo/bar/file2.txt', 'file2')
-- tests
-- check both the file + subdir exist in the item list
local files = love.filesystem.getDirectoryItems('foo')
local hasfile = false
local hasdir = false
@@ -80,23 +83,23 @@ end
-- love.filesystem.getIdentity
love.test.filesystem.getIdentity = function(test)
-- setup
-- check setting identity matches
local original = love.filesystem.getIdentity()
love.filesystem.setIdentity('lover')
-- test
test:assertEquals('lover', love.filesystem.getIdentity(), 'check identity matches')
-- cleanup
-- put back to original value
love.filesystem.setIdentity(original)
end
-- love.filesystem.getRealDirectory
love.test.filesystem.getRealDirectory = function(test)
-- setup
-- make a test dir + file first
love.filesystem.createDirectory('foo')
love.filesystem.write('foo/test.txt', 'test')
-- test
test:assertEquals(love.filesystem.getSaveDirectory(), love.filesystem.getRealDirectory('foo/test.txt'), 'check directory matches')
-- check save dir matches the real dir we just wrote to
test:assertEquals(love.filesystem.getSaveDirectory(),
love.filesystem.getRealDirectory('foo/test.txt'), 'check directory matches')
-- cleanup
love.filesystem.remove('foo/test.txt')
love.filesystem.remove('foo')
@@ -105,51 +108,52 @@ end
-- love.filesystem.getRequirePath
love.test.filesystem.getRequirePath = function(test)
test:assertEquals('?.lua;?/init.lua', love.filesystem.getRequirePath(), 'check default value')
test:assertEquals('?.lua;?/init.lua',
love.filesystem.getRequirePath(), 'check default value')
end
-- love.filesystem.getSource
-- @NOTE i dont think we can test this cos love calls it first
love.test.filesystem.getSource = function(test)
test:skipTest('not sure we can test when its internal?')
test:skipTest('not sure can be tested as used internally')
end
-- love.filesystem.getSourceBaseDirectory
-- @NOTE i think this is too platform dependent to be tested nicely
love.test.filesystem.getSourceBaseDirectory = function(test)
test:assertNotEquals(nil, love.filesystem.getSourceBaseDirectory(), 'check not nil')
test:assertNotNil(love.filesystem.getSourceBaseDirectory())
end
-- love.filesystem.getUserDirectory
-- @NOTE i think this is too platform dependent to be tested nicely
love.test.filesystem.getUserDirectory = function(test)
test:assertNotEquals(nil, love.filesystem.getUserDirectory(), 'check not nil')
test:assertNotNil(love.filesystem.getUserDirectory())
end
-- love.filesystem.getWorkingDirectory
-- @NOTE i think this is too platform dependent to be tested nicely
love.test.filesystem.getWorkingDirectory = function(test)
test:assertNotEquals(nil, love.filesystem.getWorkingDirectory(), 'check not nil')
test:assertNotNil(love.filesystem.getWorkingDirectory())
end
-- love.filesystem.getSaveDirectory
-- @NOTE i think this is too platform dependent to be tested nicely
love.test.filesystem.getSaveDirectory = function(test)
test:assertNotEquals(nil, love.filesystem.getSaveDirectory(), 'check not nil')
test:assertNotNil(love.filesystem.getSaveDirectory())
end
-- love.filesystem.getInfo
love.test.filesystem.getInfo = function(test)
-- setup
-- create a dir and subdir with a file
love.filesystem.createDirectory('foo/bar')
love.filesystem.write('foo/bar/file2.txt', 'file2')
-- tests
-- check getinfo returns the correct values
test:assertEquals(nil, love.filesystem.getInfo('foo/bar/file2.txt', 'directory'), 'check not directory')
test:assertNotEquals(nil, love.filesystem.getInfo('foo/bar/file2.txt'), 'check info not nil')
test:assertEquals(love.filesystem.getInfo('foo/bar/file2.txt').size, 5, 'check info size match')
@@ -164,18 +168,18 @@ end
-- love.filesystem.isFused
love.test.filesystem.isFused = function(test)
-- kinda assuming you'd run the testsuite in a non-fused game
test:assertEquals(love.filesystem.isFused(), false, 'check default value')
test:assertEquals(love.filesystem.isFused(), false, 'check not fused')
end
-- love.filesystem.lines
love.test.filesystem.lines = function(test)
-- setup
-- check lines returns the 3 lines expected
love.filesystem.write('file.txt', 'line1\nline2\nline3')
-- tests
local linenum = 1
for line in love.filesystem.lines('file.txt') do
test:assertEquals('line' .. tostring(linenum), line, 'check line matches')
-- also check it removes newlines like the docs says it does
test:assertEquals(nil, string.find(line, '\n'), 'check newline removed')
linenum = linenum + 1
end
@@ -186,15 +190,17 @@ end
-- love.filesystem.load
love.test.filesystem.load = function(test)
-- setup
-- 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')
-- tests
-- check file that doesn't exist
local chunk, errormsg = love.filesystem.load('faker.lua')
test:assertEquals(nil, chunk, 'check file doesnt exist')
-- check valid lua file
chunk, errormsg = love.filesystem.load('test1.lua')
test:assertEquals(nil, errormsg, 'check no error message')
test:assertEquals(1, chunk(), 'check lua file runs')
-- check invalid lua file
local ok, chunk, err = pcall(love.filesystem.load, 'test2.lua')
test:assertEquals(false, ok, 'check invalid lua file')
-- cleanup
@@ -205,10 +211,10 @@ end
-- love.filesystem.mount
love.test.filesystem.mount = function(test)
-- setup
-- write an example zip to savedir to use
local contents, size = love.filesystem.read('resources/test.zip') -- contains test.txt
love.filesystem.write('test.zip', contents, size)
-- tests
-- check mounting file and check contents are mounted
local success = love.filesystem.mount('test.zip', 'test')
test:assertEquals(true, success, 'check success')
test:assertNotEquals(nil, love.filesystem.getInfo('test'), 'check mount not nil')
@@ -222,45 +228,31 @@ love.test.filesystem.mount = function(test)
end
-- love.filesystem.newFile
-- love.filesystem.openFile
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.filesystem.newFile = function(test)
-- setup
local file = love.filesystem.newFile('file1')
local file_r, err_r = love.filesystem.newFile('file2', 'r')
local file_w, err_w = love.filesystem.newFile('file2', 'w')
local file_a, err_a = love.filesystem.newFile('file2', 'a')
local file_c, err_c = love.filesystem.newFile('file2', 'c')
-- tests
test:assertNotEquals(nil, file, 'check file made')
test:assertNotEquals(nil, file_r, 'check file made')
test:assertNotEquals(nil, file_w, 'check file made')
test:assertNotEquals(nil, file_a, 'check file made')
test:assertNotEquals(nil, file_c, 'check file made')
-- cleanup
if file ~= nil then file:release() end
if file_r ~= nil then file_r:release() end
if file_w ~= nil then file_w:release() end
if file_a ~= nil then file_a:release() end
if file_c ~= nil then file_c:release() end
love.test.filesystem.openFile = function(test)
test:assertNotNil(love.filesystem.openFile('file2', 'r'))
test:assertNotNil(love.filesystem.openFile('file2', 'w'))
test:assertNotNil(love.filesystem.openFile('file2', 'a'))
test:assertNotNil(love.filesystem.openFile('file2', 'c'))
end
-- love.filesystem.newFileData
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.filesystem.newFileData = function(test)
local data = love.filesystem.newFileData('helloworld', 'file1')
test:assertNotEquals(nil, data, 'check not nil')
data:release()
test:assertNotNil(love.filesystem.newFileData('helloworld', 'file1'))
end
-- love.filesystem.read
love.test.filesystem.read = function(test)
-- check reading a full file
local content, size = love.filesystem.read('resources/test.txt')
test:assertNotEquals(nil, content, 'check not nil')
test:assertEquals('helloworld', content, 'check content match')
test:assertEquals(10, size, 'check size match')
-- check reading partial file
content, size = love.filesystem.read('resources/test.txt', 5)
test:assertNotEquals(nil, content, 'check not nil')
test:assertEquals('hello', content, 'check content match')
@@ -270,21 +262,22 @@ end
-- love.filesystem.remove
love.test.filesystem.remove = function(test)
-- setup
-- create a dir + subdir with a file
love.filesystem.createDirectory('foo/bar')
love.filesystem.write('foo/bar/file2.txt', 'helloworld')
-- tests
-- check removing files + dirs (should fail to remove dir if file inside)
test:assertEquals(false, love.filesystem.remove('foo'), 'check fail when file inside')
test:assertEquals(false, love.filesystem.remove('foo/bar'), 'check fail when file inside')
test:assertEquals(true, love.filesystem.remove('foo/bar/file2.txt'), 'check file removed')
test:assertEquals(true, love.filesystem.remove('foo/bar'), 'check subdirectory removed')
test:assertEquals(true, love.filesystem.remove('foo'), 'check directory removed')
-- cleanup not needed here
-- cleanup not needed here hopefully...
end
-- love.filesystem.setCRequirePath
love.test.filesystem.setCRequirePath = function(test)
-- check setting path val is returned
love.filesystem.setCRequirePath('/??')
test:assertEquals('/??', love.filesystem.getCRequirePath(), 'check crequirepath value')
love.filesystem.setCRequirePath('??')
@@ -293,22 +286,21 @@ end
-- love.filesystem.setIdentity
love.test.filesystem.setIdentity = function(test)
-- setup
-- check setting identity val is returned
local original = love.filesystem.getIdentity()
-- test
love.filesystem.setIdentity('lover')
test:assertEquals('lover', love.filesystem.getIdentity(), 'check indentity value')
-- cleanup
-- return value to original
love.filesystem.setIdentity(original)
end
-- love.filesystem.setRequirePath
love.test.filesystem.setRequirePath = function(test)
-- test
-- check setting path val is returned
love.filesystem.setRequirePath('?.lua;?/start.lua')
test:assertEquals('?.lua;?/start.lua', love.filesystem.getRequirePath(), 'check require path')
-- cleanup
-- reset to default
love.filesystem.setRequirePath('?.lua;?/init.lua')
end
@@ -316,17 +308,17 @@ end
-- love.filesystem.setSource
-- @NOTE dont think can test this cos used internally?
love.test.filesystem.setSource = function(test)
test:skipTest('not sure we can test when its internal?')
test:skipTest('not sure can be tested as used internally')
end
-- love.filesystem.unmount
love.test.filesystem.unmount = function(test)
--setup
-- create a zip file mounted to use
local contents, size = love.filesystem.read('resources/test.zip') -- contains test.txt
love.filesystem.write('test.zip', contents, size)
love.filesystem.mount('test.zip', 'test')
-- tests
-- check mounted, unmount, then check its unmounted
test:assertNotEquals(nil, love.filesystem.getInfo('test/test.txt'), 'check mount exists')
love.filesystem.unmount('test.zip')
test:assertEquals(nil, love.filesystem.getInfo('test/test.txt'), 'check unmounted')
@@ -339,11 +331,10 @@ end
-- love.filesystem.write
love.test.filesystem.write = function(test)
-- setup
-- check writing a bunch of files matches whats read back
love.filesystem.write('test1.txt', 'helloworld')
love.filesystem.write('test2.txt', 'helloworld', 10)
love.filesystem.write('test3.txt', 'helloworld', 5)
-- test
test:assertEquals('helloworld', love.filesystem.read('test1.txt'), 'check read file')
test:assertEquals('helloworld', love.filesystem.read('test2.txt'), 'check read all')
test:assertEquals('hello', love.filesystem.read('test3.txt'), 'check read partial')
@@ -351,4 +342,4 @@ love.test.filesystem.write = function(test)
love.filesystem.remove('test1.txt')
love.filesystem.remove('test2.txt')
love.filesystem.remove('test3.txt')
end
end
+4 -15
View File
@@ -16,9 +16,6 @@ love.test.font.newGlyphData = function(test)
local rasterizer = love.font.newImageRasterizer(img, 'ABC', 0, 1);
local glyphdata = love.font.newGlyphData(rasterizer, 65)
test:assertObject(glyphdata)
img:release()
rasterizer:release()
glyphdata:release()
end
@@ -28,27 +25,19 @@ love.test.font.newImageRasterizer = function(test)
local img = love.image.newImageData('resources/love.png')
local rasterizer = love.font.newImageRasterizer(img, 'ABC', 0, 1);
test:assertObject(rasterizer)
img:release()
rasterizer:release()
end
-- love.font.newRasterizer
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.font.newRasterizer = function(test)
local rasterizer = love.font.newRasterizer('resources/font.ttf');
test:assertObject(rasterizer)
rasterizer:release()
test:assertObject(love.font.newRasterizer('resources/font.ttf'))
end
-- love.font.newTrueTypeRasterizer
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.font.newTrueTypeRasterizer = function(test)
local defaltraster = love.font.newTrueTypeRasterizer(12, "normal", 1)
local customraster = love.font.newTrueTypeRasterizer('resources/font.ttf', 8, "normal", 1)
test:assertObject(defaltraster)
test:assertObject(customraster)
defaltraster:release()
customraster:release()
end
test:assertObject(love.font.newTrueTypeRasterizer(12, "normal", 1))
test:assertObject(love.font.newTrueTypeRasterizer('resources/font.ttf', 8, "normal", 1))
end
File diff suppressed because it is too large Load Diff
+7 -12
View File
@@ -4,28 +4,23 @@
-- love.image.isCompressed
-- @NOTE really we need to test each of the files listed here:
-- https://love2d.org/wiki/CompressedImageFormat
-- also need to be platform dependent (e.g. dxt not suppored on phones)
love.test.image.isCompressed = function(test)
local compressed = love.image.isCompressed('resources/love.dxt1')
test:assertEquals(true, compressed, 'check dxt1 valid compressed image')
test:assertEquals(true, love.image.isCompressed('resources/love.dxt1'),
'check dxt1 valid compressed image')
end
-- love.image.newCompressedData
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.image.newCompressedData = function(test)
local imgdata = love.image.newCompressedData('resources/love.dxt1')
test:assertObject(imgdata)
imgdata:release()
test:assertObject(love.image.newCompressedData('resources/love.dxt1'))
end
-- love.image.newImageData
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.image.newImageData = function(test)
local imgdata = love.image.newImageData('resources/love.png')
local rawdata = love.image.newImageData(16, 16, 'rgba8', nil)
test:assertObject(imgdata)
test:assertObject(rawdata)
imgdata:release()
rawdata:release()
end
test:assertObject(love.image.newImageData('resources/love.png'))
test:assertObject(love.image.newImageData(16, 16, 'rgba8', nil))
end
+50 -25
View File
@@ -3,16 +3,19 @@
-- love.math.colorFromBytes
love.test.math.colorFromBytes = function(test)
-- check random value
local r, g, b, a = love.math.colorFromBytes(51, 51, 51, 51)
test:assertEquals(r, 0.2, 'check r from bytes')
test:assertEquals(g, 0.2, 'check g from bytes')
test:assertEquals(b, 0.2, 'check b from bytes')
test:assertEquals(a, 0.2, 'check a from bytes')
-- check "max" value
r, g, b, a = love.math.colorFromBytes(255, 255, 255, 255)
test:assertEquals(r, 1, 'check r from bytes')
test:assertEquals(g, 1, 'check g from bytes')
test:assertEquals(b, 1, 'check b from bytes')
test:assertEquals(a, 1, 'check a from bytes')
-- check "min" value
r, g, b, a = love.math.colorFromBytes(0, 0, 0, 0)
test:assertEquals(r, 0, 'check r from bytes')
test:assertEquals(g, 0, 'check g from bytes')
@@ -23,16 +26,19 @@ end
-- love.math.colorToBytes
love.test.math.colorToBytes = function(test)
-- check random value
local r, g, b, a = love.math.colorToBytes(0.2, 0.2, 0.2, 0.2)
test:assertEquals(r, 51, 'check bytes from r')
test:assertEquals(g, 51, 'check bytes from g')
test:assertEquals(b, 51, 'check bytes from b')
test:assertEquals(a, 51, 'check bytes from a')
-- check "max" value
r, g, b, a = love.math.colorToBytes(1, 1, 1, 1)
test:assertEquals(r, 255, 'check bytes from r')
test:assertEquals(g, 255, 'check bytes from g')
test:assertEquals(b, 255, 'check bytes from b')
test:assertEquals(a, 255, 'check bytes from a')
-- check "min" value
r, g, b, a = love.math.colorToBytes(0, 0, 0, 0)
test:assertEquals(r, 0, 'check bytes from r')
test:assertEquals(g, 0, 'check bytes from g')
@@ -65,8 +71,7 @@ end
-- love.math.getRandomState
love.test.math.getRandomState = function(test)
local state = love.math.getRandomState()
test:assertNotEquals(nil, state, 'check not nil')
test:assertNotNil(love.math.getRandomState())
end
@@ -95,49 +100,69 @@ end
-- love.math.newBezierCurve
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.math.newBezierCurve = function(test)
local curve = love.math.newBezierCurve({0, 0, 0, 1, 1, 1, 2, 1})
test:assertObject(curve)
curve:release()
test:assertObject(love.math.newBezierCurve({0, 0, 0, 1, 1, 1, 2, 1}))
end
-- love.math.newRandomGenerator
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.math.newRandomGenerator = function(test)
local rangen = love.math.newRandomGenerator()
test:assertObject(rangen)
rangen:release()
test:assertObject(love.math.newRandomGenerator())
end
-- love.math.newTransform
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.math.newTransform = function(test)
local transform = love.math.newTransform()
test:assertObject(transform)
transform:release()
test:assertObject(love.math.newTransform())
end
-- love.math.noise
love.test.math.noise = function(test)
local noise1 = love.math.noise(100)
local noise2 = love.math.noise(1, 10)
local noise3 = love.math.noise(1043, 31.123, 999)
local noise4 = love.math.noise(99.222, 10067, 8, 1843)
-- love.math.perlinNoise
love.test.math.perlinNoise = function(test)
-- check some noise values
-- output should be consistent if given the same input
local noise1 = love.math.perlinNoise(100)
local noise2 = love.math.perlinNoise(1, 10)
local noise3 = love.math.perlinNoise(1043, 31.123, 999)
local noise4 = love.math.perlinNoise(99.222, 10067, 8, 1843)
-- rounded to avoid floating point issues
test:assertEquals(50000, math.floor(noise1*100000), 'check noise 1 dimension')
test:assertEquals(47863, math.floor(noise2*100000), 'check noise 2 dimensions')
test:assertEquals(50000, math.floor(noise2*100000), 'check noise 2 dimensions')
test:assertEquals(56297, math.floor(noise3*100000), 'check noise 3 dimensions')
test:assertEquals(52579, math.floor(noise4*100000), 'check noise 4 dimensions')
end
-- love.math.simplexNoise
love.test.math.simplexNoise = function(test)
-- check some noise values
-- output should be consistent if given the same input
local noise1 = love.math.simplexNoise(100)
local noise2 = love.math.simplexNoise(1, 10)
local noise3 = love.math.simplexNoise(1043, 31.123, 999)
local noise4 = love.math.simplexNoise(99.222, 10067, 8, 1843)
-- rounded to avoid floating point issues
test:assertEquals(50000, math.floor(noise1*100000), 'check noise 1 dimension')
test:assertEquals(47863, math.floor(noise2*100000), 'check noise 2 dimensions')
test:assertEquals(26440, math.floor(noise3*100000), 'check noise 3 dimensions')
test:assertEquals(53360, math.floor(noise4*100000), 'check noise 4 dimensions')
end
-- love.math.random
love.test.math.random = function(test)
local random = love.math.random(10)
local randomminmax = love.math.random(5, 100)
test:assertRange(random, 1, 10, 'check within 1 - 10')
test:assertRange(randomminmax, 5, 100, 'check within 5 - 100')
-- check some random ranges
test:assertRange(love.math.random(10), 1, 10, 'check within 1 - 10')
test:assertRange(love.math.random(10), 1, 10, 'check within 1 - 10')
test:assertRange(love.math.random(10), 1, 10, 'check within 1 - 10')
test:assertRange(love.math.random(10), 1, 10, 'check within 1 - 10')
test:assertRange(love.math.random(10), 1, 10, 'check within 1 - 10')
test:assertRange(love.math.random(5, 100), 5, 100, 'check within 5 - 100')
test:assertRange(love.math.random(5, 100), 5, 100, 'check within 5 - 100')
test:assertRange(love.math.random(5, 100), 5, 100, 'check within 5 - 100')
test:assertRange(love.math.random(5, 100), 5, 100, 'check within 5 - 100')
test:assertRange(love.math.random(5, 100), 5, 100, 'check within 5 - 100')
end
@@ -145,8 +170,7 @@ end
-- @NOTE i dont _really_ get the range expected based on stddev + mean
-- so feel free to change to be more accurate
love.test.math.randomNormal = function(test)
local random = love.math.randomNormal(1, 0)
test:assertRange(random, -3, 3, 'check within -3 - 3')
test:assertRange(love.math.randomNormal(1, 0), -3, 3, 'check within -3 - 3')
end
@@ -162,6 +186,7 @@ end
-- love.math.setRandomState
love.test.math.setRandomState = function(test)
-- check setting state matches value returned
local rs1 = love.math.getRandomState()
love.math.setRandomState(rs1)
local rs2 = love.math.getRandomState()
@@ -175,4 +200,4 @@ love.test.math.triangulate = function(test)
local triangles2 = love.math.triangulate({1, 2, 2, 4, 3, 4, 2, 1, 3, 1}) -- weird shape
test:assertEquals(3, #triangles1, 'check polygon triangles')
test:assertEquals(3, #triangles2, 'check polygon triangles')
end
end
+13 -13
View File
@@ -45,16 +45,18 @@ love.test.objects.File = function(test)
-- @NOTE think I'm just not understanding how this is supposed to work?
-- I thought if buffering is enabled then nothing should get written until
-- buffer overflows?
file1:open('a')
ok, err = file1:setBuffer('full', 10000)
test:assertEquals(true, ok)
test:assertEquals('full', file1:getBuffer())
file1:write('morecontent')
file1:close()
file1:open('r')
contents, size = file1:read()
test:assertEquals('helloworld', contents, 'check buffered content wasnt written')
file1:close()
-- file1:open('a')
-- ok, err = file1:setBuffer('full', 10000)
-- test:assertEquals(true, ok)
-- test:assertEquals('full', file1:getBuffer())
-- file1:write('morecontent')
-- file1:close()
-- file1:open('r')
-- contents, size = file1:read()
-- test:assertEquals('helloworld', contents, 'check buffered content wasnt written')
-- file1:close()
-- @NOTE :close() commits buffer content so need to check before not after
-- test buffering and flushing
file1:open('w')
@@ -83,8 +85,6 @@ love.test.objects.File = function(test)
test:assertEquals(counter, 15)
file1:close()
file1:release()
end
@@ -172,4 +172,4 @@ end
-- Shader
-- SpriteBatch
-- Text
-- Video
-- Video
+13 -90
View File
@@ -3,27 +3,21 @@
-- love.physics.getDistance
love.test.physics.getDistance = function(test)
-- setup
-- setup two fixtues to check
local shape1 = love.physics.newEdgeShape(0, 0, 5, 5)
local shape2 = love.physics.newEdgeShape(10, 10, 15, 15)
local world = love.physics.newWorld(0, 0, false)
local body = love.physics.newBody(world, 10, 10, 'static')
local fixture1 = love.physics.newFixture(body, shape1, 1)
local fixture2 = love.physics.newFixture(body, shape2, 1)
-- test
-- check distance between them
test:assertEquals(647106, math.floor(love.physics.getDistance(fixture1, fixture2)*100000), 'check distance matches')
-- cleanup
fixture1:release()
fixture2:release()
body:release()
world:release()
shape1:release()
shape2:release()
end
-- love.physics.getMeter
love.test.physics.getMeter = function(test)
-- check value set is returned
love.physics.setMeter(30)
test:assertEquals(30, love.physics.getMeter(), 'check meter matches')
end
@@ -32,50 +26,34 @@ end
-- love.physics.newBody
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.physics.newBody = function(test)
-- setup
local world = love.physics.newWorld(1, 1, true)
local body = love.physics.newBody(world, 10, 10, 'static')
-- test
test:assertObject(body)
-- cleanup
body:release()
world:release()
end
-- love.physics.newChainShape
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.physics.newChainShape = function(test)
local obj = love.physics.newChainShape(true, 0, 0, 1, 0, 1, 1, 0, 1)
test:assertObject(obj)
obj:release()
test:assertObject(love.physics.newChainShape(true, 0, 0, 1, 0, 1, 1, 0, 1))
end
-- love.physics.newCircleShape
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.physics.newCircleShape = function(test)
local obj = love.physics.newCircleShape(10)
test:assertObject(obj)
obj:release()
test:assertObject(love.physics.newCircleShape(10))
end
-- love.physics.newDistanceJoint
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.physics.newDistanceJoint = function(test)
-- setup
local world = love.physics.newWorld(1, 1, true)
local body1 = love.physics.newBody(world, 10, 10, 'static')
local body2 = love.physics.newBody(world, 20, 20, 'static')
-- test
local obj = love.physics.newDistanceJoint(body1, body2, 10, 10, 20, 20, true)
test:assertObject(obj)
-- cleanup
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -84,25 +62,17 @@ end
love.test.physics.newEdgeShape = function(test)
local obj = love.physics.newEdgeShape(0, 0, 10, 10)
test:assertObject(obj)
obj:release()
end
-- love.physics.newFixture
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.physics.newFixture = function(test)
-- setup
local world = love.physics.newWorld(1, 1, true)
local body = love.physics.newBody(world, 10, 10, 'static')
local shape = love.physics.newCircleShape(10)
-- test
local obj = love.physics.newFixture(body, shape, 1)
test:assertObject(obj)
-- cleanup
obj:release()
shape:release()
body:release()
world:release()
end
@@ -114,10 +84,6 @@ love.test.physics.newFrictionJoint = function(test)
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newFrictionJoint(body1, body2, 15, 15, true)
test:assertObject(obj)
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -125,22 +91,14 @@ end
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.physics.newGearJoint = function(test)
local world = love.physics.newWorld(1, 1, true)
local body1 = love.physics.newBody(world, 10, 10, 'static')
local body2 = love.physics.newBody(world, 20, 20, 'static')
local body3 = love.physics.newBody(world, 30, 30, 'static')
local body4 = love.physics.newBody(world, 40, 40, 'static')
local body1 = love.physics.newBody(world, 10, 10, 'dynamic')
local body2 = love.physics.newBody(world, 20, 20, 'dynamic')
local body3 = love.physics.newBody(world, 30, 30, 'dynamic')
local body4 = love.physics.newBody(world, 40, 40, 'dynamic')
local joint1 = love.physics.newPrismaticJoint(body1, body2, 10, 10, 20, 20, true)
local joint2 = love.physics.newPrismaticJoint(body3, body4, 30, 30, 40, 40, true)
local obj = love.physics.newGearJoint(joint1, joint2, 1, true)
test:assertObject(obj)
obj:release()
joint1:release()
joint2:release()
body1:release()
body2:release()
body3:release()
body4:release()
world:release()
end
@@ -152,10 +110,6 @@ love.test.physics.newMotorJoint = function(test)
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newMotorJoint(body1, body2, 1)
test:assertObject(obj)
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -166,9 +120,6 @@ love.test.physics.newMouseJoint = function(test)
local body = love.physics.newBody(world, 10, 10, 'static')
local obj = love.physics.newMouseJoint(body, 10, 10)
test:assertObject(obj)
obj:release()
body:release()
world:release()
end
@@ -177,7 +128,6 @@ end
love.test.physics.newPolygonShape = function(test)
local obj = love.physics.newPolygonShape({0, 0, 2, 3, 2, 1, 3, 1, 5, 1})
test:assertObject(obj)
obj:release()
end
@@ -189,10 +139,6 @@ love.test.physics.newPrismaticJoint = function(test)
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newPrismaticJoint(body1, body2, 10, 10, 20, 20, true)
test:assertObject(obj)
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -204,10 +150,6 @@ love.test.physics.newPulleyJoint = function(test)
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newPulleyJoint(body1, body2, 10, 10, 20, 20, 15, 15, 25, 25, 1, true)
test:assertObject(obj)
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -229,10 +171,6 @@ love.test.physics.newRevoluteJoint = function(test)
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newRevoluteJoint(body1, body2, 10, 10, true)
test:assertObject(obj)
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -244,10 +182,6 @@ love.test.physics.newRopeJoint = function(test)
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newRopeJoint(body1, body2, 10, 10, 20, 20, 50, true)
test:assertObject(obj)
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -259,10 +193,6 @@ love.test.physics.newWeldJoint = function(test)
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newWeldJoint(body1, body2, 10, 10, true)
test:assertObject(obj)
obj:release()
body1:release()
body2:release()
world:release()
end
@@ -273,13 +203,7 @@ love.test.physics.newWheelJoint = function(test)
local body1 = love.physics.newBody(world, 10, 10, 'static')
local body2 = love.physics.newBody(world, 20, 20, 'static')
local obj = love.physics.newWheelJoint(body1, body2, 10, 10, 5, 5, true)
test:assertNotEquals(nil, obj)
test:assertEquals('userdata', type(obj))
test:assertNotEquals(nil, obj:type())
obj:release()
body1:release()
body2:release()
world:release()
test:assertObject(obj)
end
@@ -288,19 +212,18 @@ end
love.test.physics.newWorld = function(test)
local world = love.physics.newWorld(1, 1, true)
test:assertObject(world)
world:release()
end
-- love.physics.setMeter
love.test.physics.setMeter = function(test)
-- set initial meter
local world = love.physics.newWorld(1, 1, true)
love.physics.setMeter(30)
local body = love.physics.newBody(world, 300, 300, "dynamic")
-- check changing meter changes pos value relatively
love.physics.setMeter(10)
local x, y = body:getPosition()
test:assertEquals(100, x, 'check pos x')
test:assertEquals(100, y, 'check pos y')
body:release()
world:release()
end
end
+4 -7
View File
@@ -4,16 +4,13 @@
-- love.sound.newDecoder
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.sound.newDecoder = function(test)
local decoder = love.sound.newDecoder('resources/click.ogg')
test:assertObject(decoder)
test:assertObject(love.sound.newDecoder('resources/click.ogg'))
end
-- love.sound.newSoundData
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.sound.newSoundData = function(test)
local sounddata = love.sound.newSoundData('resources/click.ogg')
test:assertObject(sounddata)
local soundbeep = love.sound.newSoundData(math.floor((1/32)*44100), 44100, 16, 1)
test:assertObject(soundbeep)
end
test:assertObject(love.sound.newSoundData('resources/click.ogg'))
test:assertObject(love.sound.newSoundData(math.floor((1/32)*44100), 44100, 16, 1))
end
+20 -12
View File
@@ -4,25 +4,31 @@
-- love.system.getClipboardText
love.test.system.getClipboardText = function(test)
-- ignore if not using window
if love.test.windowmode == false then return test:skipTest('clipboard only available in window mode') end
-- setup
if love.test.windowmode == false then
return test:skipTest('clipboard only available in window mode')
end
-- check clipboard value is set
love.system.setClipboardText('helloworld')
-- test
test:assertEquals('helloworld', love.system.getClipboardText(), 'check clipboard match')
end
-- love.system.getOS
love.test.system.getOS = function(test)
-- check os is in documented values
local os = love.system.getOS()
test:assertMatch({'OS X', 'Windows', 'Linux', 'Android', 'iOS'}, os, 'check value matches')
local options = {'OS X', 'Windows', 'Linux', 'Android', 'iOS'}
test:assertMatch(options, os, 'check value matches')
end
-- love.system.getPowerInfo
love.test.system.getPowerInfo = function(test)
-- check battery state is one of the documented states
local state, percent, seconds = love.system.getPowerInfo()
test:assertMatch({'unknown', 'battery', 'nobattery', 'charging', 'charged'}, state, 'check value matches')
local states = {'unknown', 'battery', 'nobattery', 'charging', 'charged'}
test:assertMatch(states, state, 'check value matches')
-- if percent/seconds check within expected range
if percent ~= nil then
test:assertRange(percent, 0, 100, 'check value within range')
end
@@ -34,19 +40,19 @@ end
-- love.system.getProcessorCount
love.test.system.getProcessorCount = function(test)
test:assertGreaterEqual(0, love.system.getProcessorCount(), 'check not nil') -- youd hope right
test:assertNotNil(love.system.getProcessorCount()) -- youd hope right
end
-- love.system.hasBackgroundMusic
love.test.system.hasBackgroundMusic = function(test)
test:assertNotEquals(nil, love.system.hasBackgroundMusic(), 'check not nil')
test:assertNotNil(love.system.hasBackgroundMusic())
end
-- love.system.openURL
love.test.system.openURL = function(test)
test:skipTest('gets annoying to test everytime')
test:skipTest('cant test this worked')
--test:assertNotEquals(nil, love.system.openURL('https://love2d.org'), 'check open URL')
end
@@ -54,8 +60,10 @@ end
-- love.system.getClipboardText
love.test.system.setClipboardText = function(test)
-- ignore if not using window
if love.test.windowmode == false then return test:skipTest('clipboard only available in window mode') end
-- test
if love.test.windowmode == false then
return test:skipTest('clipboard only available in window mode')
end
-- check value returned is what was set
love.system.setClipboardText('helloworld')
test:assertEquals('helloworld', love.system.getClipboardText(), 'check set text')
end
@@ -64,5 +72,5 @@ end
-- love.system.vibrate
-- @NOTE cant really test this
love.test.system.vibrate = function(test)
test:skipTest('cant really test this')
end
test:skipTest('cant test this worked')
end
+4 -10
View File
@@ -4,25 +4,19 @@
-- love.thread.getChannel
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.thread.getChannel = function(test)
local channel = love.thread.getChannel('test')
test:assertObject(channel)
channel:release()
test:assertObject(love.thread.getChannel('test'))
end
-- love.thread.newChannel
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.thread.newChannel = function(test)
local channel = love.thread.newChannel()
test:assertObject(channel)
channel:release()
test:assertObject(love.thread.newChannel())
end
-- love.thread.newThread
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.thread.newThread = function(test)
local thread = love.thread.newThread('classes/TestSuite.lua')
test:assertObject(thread)
thread:release()
end
test:assertObject(love.thread.newThread('classes/TestSuite.lua'))
end
+5 -5
View File
@@ -4,20 +4,20 @@
-- love.timer.getAverageDelta
-- @NOTE not sure if you could reliably get a specific delta?
love.test.timer.getAverageDelta = function(test)
test:assertNotEquals(nil, love.timer.getAverageDelta(), 'check not nil')
test:assertNotNil(love.timer.getAverageDelta())
end
-- love.timer.getDelta
-- @NOTE not sure if you could reliably get a specific delta?
love.test.timer.getDelta = function(test)
test:assertNotEquals(nil, love.timer.getDelta(), 'check not nil')
test:assertNotNil(love.timer.getDelta())
end
-- love.timer.getFPS
-- @NOTE not sure if you could reliably get a specific FPS?
love.test.timer.getFPS = function(test)
test:assertNotEquals(nil, love.timer.getFPS(), 'check not nil')
test:assertNotNil(love.timer.getFPS())
end
@@ -41,5 +41,5 @@ end
-- love.timer.step
-- @NOTE not sure if you could reliably get a specific step val?
love.test.timer.step = function(test)
test:assertNotEquals(nil, love.timer.step(), 'check not nil')
end
test:assertNotNil(love.timer.step())
end
+2 -4
View File
@@ -4,7 +4,5 @@
-- love.video.newVideoStream
-- @NOTE this is just basic nil checking, full obj test are in objects.lua
love.test.video.newVideoStream = function(test)
local videostream = love.video.newVideoStream('resources/sample.ogv')
test:assertObject(videostream)
videostream:release()
end
test:assertObject(love.video.newVideoStream('resources/sample.ogv'))
end
+71 -40
View File
@@ -2,19 +2,21 @@
-- love.window.close
-- @NOTE closing window should cause graphics to no longer be active
love.test.window.close = function(test)
-- closing window should cause graphics to not be active
love.window.close()
local active = false
if love.graphics ~= nil then active = love.graphics.isActive() end
if love.graphics ~= nil then
active = love.graphics.isActive()
end
test:assertEquals(false, active, 'check window active')
love.window.setMode(256, 256) -- reset
end
-- love.window.fromPixels
-- @NOTE dependent on the DPI value returned I think
love.test.window.fromPixels = function(test)
-- check dpi/pixel ratio as expected
local dpi = love.window.getDPIScale()
local pixels = love.window.fromPixels(100)
test:assertEquals(100/dpi, pixels, 'check dpi ratio')
@@ -22,9 +24,9 @@ end
-- love.window.getDPIScale
-- @NOTE i dont think there's a clever way to check this
-- @NOTE dependent on hardware so best can do is not nil
love.test.window.getDPIScale = function(test)
test:assertNotEquals(nil, test, 'check not nil')
test:assertNotNil(test)
end
@@ -32,59 +34,58 @@ end
-- @NOTE dependent on hardware so best can do is not nil
love.test.window.getDesktopDimensions = function(test)
local w, h = love.window.getDesktopDimensions()
test:assertNotEquals(nil, w, 'check not nil')
test:assertNotEquals(nil, h, 'check not nil')
test:assertNotNil(w)
test:assertNotNil(h)
end
-- love.window.getDisplayCount
-- @NOTE cant wait for the test suite to be run headless and fail here
love.test.window.getDisplayCount = function(test)
local count = love.window.getDisplayCount()
test:assertGreaterEqual(1, count, 'check 1 display')
test:assertGreaterEqual(1, love.window.getDisplayCount(), 'check 1 display')
end
-- love.window.getDisplayName
-- @NOTE dependent on hardware so best can do is not nil
love.test.window.getDisplayName = function(test)
local name = love.window.getDisplayName(1)
test:assertNotEquals(nil, name, 'check not nil')
test:assertNotNil(love.window.getDisplayName(1))
end
-- love.window.getDisplayOrientation
-- @NOTE dependent on hardware so best can do is not nil
love.test.window.getDisplayOrientation = function(test)
local orientation = love.window.getDisplayOrientation(1)
test:assertNotEquals(nil, orientation, 'check not nil')
test:assertNotNil(love.window.getDisplayOrientation(1))
end
-- love.window.getFullscreen
love.test.window.getFullscreen = function(test)
-- check not fullscreen to start
test:assertEquals(false, love.window.getFullscreen(), 'check not fullscreen')
love.window.setFullscreen(true)
-- check now fullscreen
test:assertEquals(true, love.window.getFullscreen(), 'check now fullscreen')
love.window.setFullscreen(false)
love.window.setFullscreen(false) -- reset
end
-- love.window.getFullscreenModes
-- @NOTE dependent on hardware so best can do is not nil
love.test.window.getFullscreenModes = function(test)
local modes = love.window.getFullscreenModes(1)
test:assertNotEquals(nil, modes, 'check not nil')
test:assertNotNil(love.window.getFullscreenModes(1))
end
-- love.window.getIcon
love.test.window.getIcon = function(test)
test:assertEquals(nil, love.window.getIcon(), 'check nil by default') -- nil if not set
-- check icon nil by default if not set
test:assertEquals(nil, love.window.getIcon(), 'check nil by default')
local icon = love.image.newImageData('resources/love.png')
-- check getting icon not nil after setting
love.window.setIcon(icon)
test:assertNotEquals(nil, love.window.getIcon(), 'check not nil')
icon:release()
test:assertNotNil(love.window.getIcon())
end
@@ -112,15 +113,16 @@ end
-- @NOTE dependent on hardware so best can do is not nil
love.test.window.getSafeArea = function(test)
local x, y, w, h = love.window.getSafeArea()
test:assertNotEquals(nil, x, 'check not nil')
test:assertNotEquals(nil, y, 'check not nil')
test:assertNotEquals(nil, w, 'check not nil')
test:assertNotEquals(nil, h, 'check not nil')
test:assertNotNil(x)
test:assertNotNil(y)
test:assertNotNil(w)
test:assertNotNil(h)
end
-- love.window.getTitle
love.test.window.getTitle = function(test)
-- check title returned is what was set
love.window.setTitle('love.testing')
test:assertEquals('love.testing', love.window.getTitle(), 'check title match')
love.window.setTitle('love.test')
@@ -129,33 +131,37 @@ end
-- love.window.getVSync
love.test.window.getVSync = function(test)
test:assertNotEquals(nil, love.window.getVSync(), 'check not nil')
love.window.setVSync(false)
test:assertNotNil(love.window.getVSync())
-- check turning off
love.window.setVSync(0)
test:assertEquals(0, love.window.getVSync(), 'check vsync off')
love.window.setVSync(true)
-- check turning on
love.window.setVSync(1)
test:assertEquals(1, love.window.getVSync(), 'check vsync on')
end
-- love.window.hasFocus
-- @NOTE cant really test as cant force focus?
-- @NOTE cant really test as cant force focus
love.test.window.hasFocus = function(test)
test:assertNotEquals(nil, love.window.hasFocus(), 'check not nil')
test:assertNotNil(love.window.hasFocus())
end
-- love.window.hasMouseFocus
-- @NOTE cant really test as cant force focus?
-- @NOTE cant really test as cant force focus
love.test.window.hasMouseFocus = function(test)
test:assertNotEquals(nil, love.window.hasMouseFocus(), 'check not nil')
test:assertNotNil(love.window.hasMouseFocus())
end
-- love.window.isDisplaySleepEnabled
love.test.window.isDisplaySleepEnabled = function(test)
test:assertNotEquals(nil, love.window.isDisplaySleepEnabled(), 'check not nil')
test:assertNotNil(love.window.isDisplaySleepEnabled())
-- check disabled
love.window.setDisplaySleepEnabled(false)
test:assertEquals(false, love.window.isDisplaySleepEnabled(), 'check sleep disabled')
-- check enabled
love.window.setDisplaySleepEnabled(true)
test:assertEquals(true, love.window.isDisplaySleepEnabled(), 'check sleep enabled')
end
@@ -163,8 +169,10 @@ end
-- love.window.isMaximized
love.test.window.isMaximized = function(test)
-- check minimized to start
love.window.minimize()
test:assertEquals(false, love.window.isMaximized(), 'check window maximized')
-- try to mazimize
love.window.maximize()
test:assertEquals(true, love.window.isMaximized(), 'check window not maximized')
love.window.restore()
@@ -173,7 +181,9 @@ end
-- love.window.isMinimized
love.test.window.isMinimized = function(test)
-- check not minimized to start
test:assertEquals(false, love.window.isMinimized(), 'check window not minimized')
-- try to minimize
love.window.minimize()
test:assertEquals(true, love.window.isMinimized(), 'check window minimized')
love.window.restore()
@@ -182,7 +192,9 @@ end
-- love.window.isOpen
love.test.window.isOpen = function(test)
-- check open initially
test:assertEquals(true, love.window.isOpen(), 'check window open')
-- try closing
love.window.close()
test:assertEquals(false, love.window.isOpen(), 'check window closed')
love.window.setMode(256, 256) -- reset
@@ -191,7 +203,9 @@ end
-- love.window.isVisible
love.test.window.isVisible = function(test)
-- check visible initially
test:assertEquals(true, love.window.isVisible(), 'check window visible')
-- check closing makes window not visible
love.window.close()
test:assertEquals(false, love.window.isVisible(), 'check window not visible')
love.window.setMode(256, 256) -- reset
@@ -200,6 +214,7 @@ end
-- love.window.maximize
love.test.window.maximize = function(test)
-- check maximizing is set
love.window.maximize()
test:assertEquals(true, love.window.isMaximized(), 'check window maximized')
love.window.restore()
@@ -208,6 +223,7 @@ end
-- love.window.minimize
love.test.window.minimize = function(test)
-- check minimizing is set
love.window.minimize()
test:assertEquals(true, love.window.isMinimized(), 'check window minimized')
love.window.restore()
@@ -215,15 +231,17 @@ end
-- love.window.requestAttention
love.window.requestAttention = function(test)
test:skipTest('cant really test this')
love.test.window.requestAttention = function(test)
test:skipTest('cant test this worked')
end
-- love.window.restore
love.test.window.restore = function(test)
-- check minimized to start
love.window.minimize()
test:assertEquals(true, love.window.isMinimized(), 'check window minimized')
-- check restoring the state of the window
love.window.restore()
test:assertEquals(false, love.window.isMinimized(), 'check window restored')
end
@@ -231,8 +249,10 @@ end
-- love.window.setDisplaySleepEnabled
love.test.window.setDisplaySleepEnabled = function(test)
-- check disabling sleep
love.window.setDisplaySleepEnabled(false)
test:assertEquals(false, love.window.isDisplaySleepEnabled(), 'check sleep disabled')
-- check setting it back to enabled
love.window.setDisplaySleepEnabled(true)
test:assertEquals(true, love.window.isDisplaySleepEnabled(), 'check sleep enabled')
end
@@ -240,8 +260,10 @@ end
-- love.window.setFullscreen
love.test.window.setFullscreen = function(test)
-- check fullscreen is set
love.window.setFullscreen(true)
test:assertEquals(true, love.window.getFullscreen(), 'check fullscreen')
-- check setting back to normal
love.window.setFullscreen(false)
test:assertEquals(false, love.window.getFullscreen(), 'check not fullscreen')
end
@@ -250,20 +272,22 @@ end
-- love.window.setIcon
-- @NOTE could check the image data itself?
love.test.window.setIcon = function(test)
-- check setting an icon returns the val
local icon = love.image.newImageData('resources/love.png')
love.window.setIcon(icon)
test:assertNotEquals(nil, love.window.getIcon(), 'check icon not nil')
icon:release()
end
-- love.window.setMode
-- @NOTE same as getMode could be checking more flag properties
love.test.window.setMode = function(test)
-- set window mode
love.window.setMode(512, 512, {
fullscreen = false,
resizable = false
})
-- check what we set is returned
local width, height, flags = love.window.getMode()
test:assertEquals(512, width, 'check window w match')
test:assertEquals(512, height, 'check window h match')
@@ -277,6 +301,7 @@ end
-- love.window.setPosition
love.test.window.setPosition = function(test)
-- check position is returned
love.window.setPosition(100, 100, 1)
local x, y, _ = love.window.getPosition()
test:assertEquals(100, x, 'check position x')
@@ -286,6 +311,7 @@ end
-- love.window.setTitle
love.test.window.setTitle = function(test)
-- check setting title val is returned
love.window.setTitle('love.testing')
test:assertEquals('love.testing', love.window.getTitle(), 'check title matches')
love.window.setTitle('love.test')
@@ -294,23 +320,25 @@ end
-- love.window.setVSync
love.test.window.setVSync = function(test)
love.window.setVSync(false)
-- check setting vsync value off
love.window.setVSync(0)
test:assertEquals(0, love.window.getVSync(), 'check vsync off')
love.window.setVSync(true)
-- check setting vsync value on
love.window.setVSync(1)
test:assertEquals(1, love.window.getVSync(), 'check vsync on')
end
-- love.window.showMessageBox
-- @NOTE if running headless would need to skip anyway cos can't press it
-- skipping here cos it's annoying
love.test.window.showMessageBox = function(test)
test:skipTest('skipping cos annoying to test with')
test:skipTest('cant test this worked')
end
-- love.window.toPixels
love.test.window.toPixels = function(test)
-- check dpi/pixel ratio is as expected
local dpi = love.window.getDPIScale()
local pixels = love.window.toPixels(50)
test:assertEquals(50*dpi, pixels, 'check dpi ratio')
@@ -319,18 +347,21 @@ end
-- love.window.updateMode
love.test.window.updateMode = function(test)
-- set initial mode
love.window.setMode(512, 512, {
fullscreen = false,
resizable = false
})
-- update mode with some props but not others
love.window.updateMode(256, 256, nil)
-- check only changed values changed
local width, height, flags = love.window.getMode()
test:assertEquals(256, width, 'check window w match')
test:assertEquals(256, height, 'check window h match')
test:assertEquals(false, flags["fullscreen"], 'check window not fullscreen')
test:assertEquals(false, flags["resizable"], 'check window not resizeable')
love.window.setMode(256, 256, {
love.window.setMode(256, 256, { -- reset
fullscreen = false,
resizable = true
})
end
end
+26
View File
@@ -0,0 +1,26 @@
`/Applications/love_12.app/Contents/MacOS/love ./testing`
# v0.2
## Changed
- Added tests for all obj creation, transformation, window + system info graphics methods
- Added half the state methods for graphics + added placeholders for missing drawing methods
- Added TestMethod:assertNotNil() for quick nil checking
- Added time total to the end of each module summary in console log to match file output
- Removed a bunch of unessecary nil checks
- Removed :release() from test methods, collectgarbage("collect") is called between methods instead
- Renamed /output to /examples to avoid confusion
- Replaced love.filesystem.newFile with love.filesystem.openFile
- Replaced love.math.noise with love.math.perlinNoise / love.math.simplexNoise
- Fixed newGearJoint throwing an error in 12 as body needs to be dynamic not static now
- Some general cleanup, incl. better comments and time format in file output
## Todo
- graphics state methods
- graphics drawing methods
- need a platform: format table somewhere for compressed formats (i.e. DXT not supported)