diff --git a/testing/examples/lovetest_runAllTests.html b/testing/examples/lovetest_runAllTests.html index 906348df6..48e480fcc 100644 --- a/testing/examples/lovetest_runAllTests.html +++ b/testing/examples/lovetest_runAllTests.html @@ -1 +1 @@ -

🔴 love.test



🟢 love.audio

\ No newline at end of file +

🟢 love.test



🟢 love.audio

\ No newline at end of file diff --git a/testing/examples/lovetest_runAllTests.md b/testing/examples/lovetest_runAllTests.md index 0c75c10f7..43e37f846 100644 --- a/testing/examples/lovetest_runAllTests.md +++ b/testing/examples/lovetest_runAllTests.md @@ -1,30 +1,27 @@ - + ### Info -**301** tests were completed in **14.670s** with **285** passed, **1** failed, and **15** skipped +**301** tests were completed in **14.726s** with **287** passed, **0** failed, and **14** skipped Renderer: OpenGL | 4.1 Metal - 76.3 | Apple | Apple M1 Max ### Report | Module | Pass | Fail | Skip | Time | | --------------------- | ------ | ------ | ------- | ------ | -| 🟢 audio | 28 | 0 | 0 | 0.890s | -| 🟢 data | 12 | 0 | 0 | 0.205s | -| 🟢 event | 4 | 0 | 2 | 0.102s | -| 🟢 filesystem | 29 | 0 | 2 | 0.530s | -| 🔴 font | 6 | 1 | 0 | 0.121s | -| 🟢 graphics | 102 | 0 | 3 | 3.232s | -| 🟢 image | 5 | 0 | 0 | 0.086s | -| 🟢 math | 20 | 0 | 0 | 0.339s | -| 🟢 physics | 22 | 0 | 4 | 0.434s | -| 🟢 sound | 4 | 0 | 0 | 0.071s | -| 🟢 system | 6 | 0 | 2 | 0.139s | -| 🟢 thread | 5 | 0 | 0 | 0.376s | -| 🟢 timer | 6 | 0 | 0 | 2.091s | -| 🟢 video | 2 | 0 | 0 | 0.039s | -| 🟢 window | 34 | 0 | 2 | 6.015s | +| 🟢 audio | 28 | 0 | 0 | 0.894s | +| 🟢 data | 12 | 0 | 0 | 0.209s | +| 🟢 event | 4 | 0 | 2 | 0.103s | +| 🟢 filesystem | 29 | 0 | 2 | 0.550s | +| 🟢 font | 7 | 0 | 0 | 0.124s | +| 🟢 graphics | 102 | 0 | 3 | 3.231s | +| 🟢 image | 5 | 0 | 0 | 0.098s | +| 🟢 math | 20 | 0 | 0 | 0.353s | +| 🟢 physics | 23 | 0 | 3 | 0.449s | +| 🟢 sound | 4 | 0 | 0 | 0.074s | +| 🟢 system | 6 | 0 | 2 | 0.144s | +| 🟢 thread | 5 | 0 | 0 | 0.377s | +| 🟢 timer | 6 | 0 | 0 | 2.093s | +| 🟢 video | 2 | 0 | 0 | 0.040s | +| 🟢 window | 34 | 0 | 2 | 5.986s | ### Failures -> 🔴 GlyphData -> assert 8 [check glyph number] expected '97' got '0' - diff --git a/testing/examples/lovetest_runAllTests.xml b/testing/examples/lovetest_runAllTests.xml index 0ae096f1c..99b1925c3 100644 --- a/testing/examples/lovetest_runAllTests.xml +++ b/testing/examples/lovetest_runAllTests.xml @@ -1,30 +1,30 @@ - - - + + + - + - + - + - + - + - + - + - + - + - + - + @@ -38,15 +38,15 @@ - + - + - + @@ -54,108 +54,108 @@ - + - - + + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -165,72 +165,71 @@ - - - assert 8 [check glyph number] expected '97' got '0' + + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -240,297 +239,296 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - + @@ -539,103 +537,103 @@ - - + + - + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/testing/readme.md b/testing/readme.md index a6bace051..b01c6c690 100644 --- a/testing/readme.md +++ b/testing/readme.md @@ -115,12 +115,12 @@ Test classes that still need to be written: - [ ] graphics.ParticleSystem - [ ] physics.Body - [ ] physics.Contact -- [ ] physics.Joint - [ ] physics.Shape --- -## Future Goals +## Future +- [ ] font class tests (Rasterizer + GlyphData) with BMfonts - [ ] graphics.isCompressed should have an example of all compressed files love can take - [ ] Tests can compare visual results to a reference image This is partially done as we already save actual images for graphics tests to diff --git a/testing/resources/font.bmp b/testing/resources/font.bmp new file mode 100644 index 000000000..3180d031c Binary files /dev/null and b/testing/resources/font.bmp differ diff --git a/testing/tests/font.lua b/testing/tests/font.lua index 695da4120..1e6597c4f 100644 --- a/testing/tests/font.lua +++ b/testing/tests/font.lua @@ -19,8 +19,16 @@ love.test.font.GlyphData = function(test) test:assertEquals(128, gdata:getSize(), 'check data size') test:assertEquals(9, gdata:getAdvance(), 'check advance') test:assertEquals('la8', gdata:getFormat(), 'check format') - test:assertEquals(97, gdata:getGlyph(), 'check glyph number') - test:assertEquals('a', gdata:getGlyphString(), 'check glyph string') + -- @TODO + --[[ + currently these will return 0 and '' respectively as not implemented + https://github.com/love2d/love/blob/12.0-development/src/modules/font/freetype/TrueTypeRasterizer.cpp#L140-L141 + "basically I haven't decided what to do here yet, because of the more + advanced text shaping that happens in love 12 having a unicode codepoint + associated with a glyph probably doesn't make sense in the first place" + ]]-- + --test:assertEquals(97, gdata:getGlyph(), 'check glyph number') - returns 0 + --test:assertEquals('a', gdata:getGlyphString(), 'check glyph string') - returns '' test:assertEquals(8, gdata:getHeight(), 'check height') test:assertEquals(8, gdata:getWidth(), 'check width') -- check boundary diff --git a/testing/tests/physics.lua b/testing/tests/physics.lua index a10f53bb7..f978eda12 100644 --- a/testing/tests/physics.lua +++ b/testing/tests/physics.lua @@ -22,12 +22,38 @@ end -- Joint (love.physics.newDistanceJoint) love.test.physics.Joint = function(test) - test:skipTest('test class needs writing') + -- make joint + local world = love.physics.newWorld(1, 1, true) + local body1 = love.physics.newBody(world, 10, 10, 'dynamic') + local body2 = love.physics.newBody(world, 20, 20, 'dynamic') + local joint = love.physics.newDistanceJoint(body1, body2, 10, 10, 20, 20, true) + test:assertObject(joint) + -- check props + test:assertEquals('distance', joint:getType(), 'check joint type') + test:assertEquals(false, joint:isDestroyed(), 'check not destroyed') + test:assertEquals(0, joint:getReactionForce(1), 'check reaction force') + test:assertEquals(0, joint:getReactionTorque(1), 'check reaction torque') + local b1, b2 = joint:getBodies() + test:assertEquals(body1:getX(), b1:getX(), 'check body 1') + test:assertEquals(body2:getX(), b2:getX(), 'check body 2') + local x1, y1, x2, y2 = joint:getAnchors() + test:assertEquals(10, x1, 'check anchor x1') + test:assertEquals(10, y1, 'check anchor y1') + test:assertEquals(20, x2, 'check anchor x2') + test:assertEquals(20, y2, 'check anchor y2') + test:assertEquals(true, joint:getCollideConnected(), 'check not colliding') + -- test userdata + test:assertEquals(nil, joint:getUserData(), 'check no data by def') + joint:setUserData('hello') + test:assertEquals('hello', joint:getUserData(), 'check set userdata') + -- destroy + joint:destroy() + test:assertEquals(true, joint:isDestroyed(), 'check destroyed') end -- Shape (love.physics.newCircleShape) --- @NOTE includes Fixture methods too enjoy +-- @NOTE includes Fixture methods too now so enjoy love.test.physics.Shape = function(test) test:skipTest('test class needs writing') end @@ -45,8 +71,8 @@ love.test.physics.World = function(test) test:assertEquals(0, world:getBodies()[1]:getX(), 'check body prop x') test:assertEquals(0, world:getBodies()[1]:getY(), 'check body prop y') world:translateOrigin(-10, -10) - test:assertEquals(10, world:getBodies()[1]:getX(), 'check body prop change x') - test:assertEquals(10, world:getBodies()[1]:getY(), 'check body prop change y') + test:assertEquals(10, math.floor(world:getBodies()[1]:getX()), 'check body prop change x') + test:assertEquals(10, math.floor(world:getBodies()[1]:getY()), 'check body prop change y') test:assertEquals(1, world:getBodyCount(), 'check 1 body count') test:assertEquals(false, world:isDestroyed(), 'check not destroyed') test:assertEquals(false, world:isLocked(), 'check not updating')