From 71f379e268da0ded4f32b04c50b464951d1f099c Mon Sep 17 00:00:00 2001 From: ell <77150506+ellraiser@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:49:18 +0000 Subject: [PATCH] update isOS method --- testing/classes/TestMethod.lua | 15 ++++++--------- testing/classes/TestSuite.lua | 2 +- testing/tests/graphics.lua | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/testing/classes/TestMethod.lua b/testing/classes/TestMethod.lua index 931dad850..9838b9f67 100644 --- a/testing/classes/TestMethod.lua +++ b/testing/classes/TestMethod.lua @@ -376,17 +376,14 @@ TestMethod = { -- @method - TestMethod:isOS() -- @desc - checks for a specific OS (or list of OSs) - -- @param {string||table} - single OS string or list of OSs that are allowed, - -- these will be checked agaisnt love.system.getOS()'s return value + -- @param {string/s} - each arg passed will be checked as a valid OS, as long + -- as one passed the function will return true -- @return {boolean} - returns true if one of the OSs given matches actual OS - isOS = function(self, oss) - if type(oss) == 'table' then - for o=1,#oss do - if oss[o] == love.test.current_os then return true end - end - else - return love.test.current_os == oss + isOS = function(self, ...) + for os=1,select("#", ...) do + if select(os, ...) == love.test.current_os then return true end end + return false end, -- @method - TestMethod:evaluateTest() diff --git a/testing/classes/TestSuite.lua b/testing/classes/TestSuite.lua index a5c3e841a..4777281e6 100644 --- a/testing/classes/TestSuite.lua +++ b/testing/classes/TestSuite.lua @@ -23,7 +23,7 @@ TestSuite = { delayed = nil, fakequit = false, windowmode = true, - current_os = love.system.getOS(), + current_os = love._os, -- love modules to test audio = {}, diff --git a/testing/tests/graphics.lua b/testing/tests/graphics.lua index 69390bce4..b55764444 100644 --- a/testing/tests/graphics.lua +++ b/testing/tests/graphics.lua @@ -1467,7 +1467,7 @@ love.test.graphics.captureScreenshot = function(test) TextCommand = prevtextcommand test:assertNotNil(cbdata) - if test:isOS({'iOS', 'Android'}) then + if test:isOS('iOS', 'Android') then -- Mobile operating systems don't let us control the window resolution, -- so we can't compare the reference image properly. test:assertTrue(true, 'skip test')