mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
990259edf9
- added custom error handler so that love is closed if a crash occurs rather than hang on the graphic screen (for runner crashes mainly)
- updated missing functions left todo in todo.md and removed list from readme.md to make it easier to keep track of
- added love.audio.getPlaybackDevice(), love.audio.getPlaybackDevices(), love.audio.setPlaybackDevice()
- added love.data.ByteData:setString()
- added love.filesystem.getFullCommonPath(), love.filesystem.mountFullPath(), love.filesystem.unmountFullPath(), love.filesystem.moundCommonPath(), plus optional b/t/bt params to love.filesystem.load()
- added love.keyboard.isModifierActive()
- added love.sound.SoundData:copy() and love.sound.SoundData:slice()
- added love.graphics.Texture:isCanvas() and love.graphics.Texture:isComputeWritable()
- added love.image.ImageData:isLinear(), love.image.ImageData:setLinear(), and love.image.ImageData:encode("*.exr")
- added love.image.CompressedImageData:isLinear() and love.image.CompressedImageData:setLinear()
- added love.system.getPreferredLocales()
- added love.window.focus() and removed love.window.close() (now deprecated)
92 lines
2.9 KiB
Lua
92 lines
2.9 KiB
Lua
-- love.system
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
--------------------------------------------------------------------------------
|
|
----------------------------------METHODS---------------------------------------
|
|
--------------------------------------------------------------------------------
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
-- 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
|
|
-- check clipboard value is set
|
|
love.system.setClipboardText('helloworld')
|
|
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()
|
|
local options = {'OS X', 'Windows', 'Linux', 'Android', 'iOS'}
|
|
test:assertMatch(options, os, 'check value matches')
|
|
end
|
|
|
|
|
|
-- love.system.getPreferredLocales
|
|
love.test.system.getPreferredLocales = function(test)
|
|
local locale = love.system.getPreferredLocales()
|
|
test:assertNotNil(locale)
|
|
test:assertEquals('table', type(locale), 'check returns table')
|
|
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()
|
|
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 battery percent within range')
|
|
end
|
|
if seconds ~= nil then
|
|
test:assertNotNil(seconds)
|
|
end
|
|
end
|
|
|
|
|
|
-- love.system.getProcessorCount
|
|
love.test.system.getProcessorCount = function(test)
|
|
test:assertNotNil(love.system.getProcessorCount()) -- youd hope right
|
|
end
|
|
|
|
|
|
-- love.system.hasBackgroundMusic
|
|
love.test.system.hasBackgroundMusic = function(test)
|
|
test:assertNotNil(love.system.hasBackgroundMusic())
|
|
end
|
|
|
|
|
|
-- love.system.openURL
|
|
love.test.system.openURL = function(test)
|
|
test:skipTest('cant test this worked')
|
|
--test:assertNotEquals(nil, love.system.openURL('https://love2d.org'), 'check open URL')
|
|
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
|
|
-- check value returned is what was set
|
|
love.system.setClipboardText('helloworld')
|
|
test:assertEquals('helloworld', love.system.getClipboardText(), 'check set text')
|
|
end
|
|
|
|
|
|
-- love.system.vibrate
|
|
-- @NOTE cant really test this
|
|
love.test.system.vibrate = function(test)
|
|
test:skipTest('cant test this worked')
|
|
end
|