Let's see if the app viewport stops overflowing the Android device.
XVBG663EOTTWH37VI52GLICHJUO4RY6YKJ265V3LQGT3Q52KJUYAC
ORRSP7FVCHI2TF5GXBRGQYYJAA3JFYXZBM3T663BKSBV22FCZVCAC
4J4TX7ISH3VIRSDYMGIJJ2WMTI2LPYJHFRWGGMXCEFTAYZOWXMAQC
OMLASW7KT5UWFXNGUFLLIKGDZ6OJETV5JAT53XKSNGMSML4WTOQQC
YD46MI2FYKOWUUVGYRRRSDEXYJUJKZO5RFVUBJBCNMZYVS3MXDAQC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
CE4LZV4TNXJT54CVGM3QANCBP42TMLMZWF2DBSMUYKAHILXIZEMQC
KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC
V7LATJC7BMSIZWVQKQXPS5ZYL24FDBMGPX54GV6FL2KNWIB5UTHQC
2WGHUWE6DWRNUD7AJNLGT4I6PZ2EIVDQCZ7V7V7WSYPBRPYUUDUQC
CNCYMM6ABOXCRI2IP5A4T2OGBO5FQ7GWBXBP2OQYL4YET5BLJCGQC
LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC
QZ2SXLHF6G3RBSLFIOYM3AQYWLGPWRTASNNQMOQBI5ASUAYCO6UAC
HCFDBUXHWT4IBY3QHR2LBN26L7LVCBZI6H353JE6W7QNLCEDCCCQC
5RDWSYK2YESTIEDMGOD2T7E4KCOA6DOM35ECMZT2XZT57JSCRJEQC
EJOZAD7N3G5IIPRVRXV2T2JV36LAFNWHPL3TRBKAOIKT63M7FYRAC
CQYKYJJU3NMY2CNXF7VZWSDYU3SWPFWA3ZHDW24Q4S6QEK5Y2TSAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
function test_resize_window()
App.resize(200, 400)
-- ugly; resize switches to real, non-test margins
-- TODO: how to make assertions about when App.update got past the early exit?
end
check_eq(App.screen.width, 200, 'width')
check_eq(App.screen.height, 400, 'height')
check_eq(Editor_state.left, Margin_left, 'left_margin')
check_eq(Editor_state.right, 200-Margin_right, 'right_margin')
check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'drawing_width')
App.screen.init{width=300, height=300}
Editor_state.filename = 'foo'
check_eq(App.screen.width, 300, 'baseline/width')
check_eq(App.screen.height, 300, 'baseline/height')
check_eq(Editor_state.left, Test_margin_left, 'baseline/left_margin')
check_eq(Editor_state.right, 300 - Test_margin_right, 'baseline/left_margin')
Editor_state = edit.initialize_test_state()
-- determine default dimensions and flags
App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
-- set up desired window dimensions
App.screen.flags.resizable = true
App.screen.flags.minwidth = math.min(App.screen.width, 200)
App.screen.flags.minheight = math.min(App.screen.height, 200)
App.screen.width, App.screen.height = Settings.width, Settings.height
App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
App.screen.move(Settings.x, Settings.y, Settings.displayindex)
function run.initialize_window_geometry(em_width)
local os = love.system.getOS()
if os == 'Android' or os == 'iOS' then
-- maximizing on iOS breaks text rendering: https://github.com/deltadaedalus/vudu/issues/7
-- no point second-guessing window dimensions on mobile
App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
return
end
-- maximize window
App.screen.resize(0, 0) -- maximize
App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
-- shrink height slightly to account for window decoration
App.screen.height = App.screen.height-100
App.screen.width = 40*em_width
App.screen.flags.resizable = true
App.screen.flags.minwidth = math.min(App.screen.width, 200)
App.screen.flags.minheight = math.min(App.screen.height, 200)
App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
end
function run.resize(w, h)
--? print(("Window resized to width: %d and height: %d."):format(w, h))
App.screen.width, App.screen.height = w, h
Text.redraw_all(Editor_state)
Editor_state.selection1 = {} -- no support for shift drag while we're resizing
Editor_state.right = App.screen.width-Margin_right
Editor_state.width = Editor_state.right-Editor_state.left
Text.tweak_screen_top_and_cursor(Editor_state, Editor_state.left, Editor_state.right)
end