new test: dragging and dropping a file on lines.love

This commit is contained in:
Kartik K. Agaram 2022-06-29 17:52:40 -07:00
parent 9410cccb08
commit bfbe73e0ef
1 changed files with 27 additions and 0 deletions

View File

@ -10,6 +10,33 @@ function test_resize_window()
-- TODO: how to make assertions about when App.update got past the early exit?
end
function test_drop_file()
io.write('\ntest_drop_file')
App.screen.init{width=Margin_left+300, height=300}
App.filesystem['foo'] = 'abc\ndef\nghi\n'
local fake_dropped_file = {
opened = false,
getFilename = function(self)
return 'foo'
end,
open = function(self)
self.opened = true
end,
lines = function(self)
assert(self.opened)
return App.filesystem['foo']:gmatch('[^\n]+')
end,
close = function(self)
self.opened = false
end,
}
App.filedropped(fake_dropped_file)
check_eq(#Lines, 3, 'F - test_drop_file/#lines')
check_eq(Lines[1].data, 'abc', 'F - test_drop_file/lines:1')
check_eq(Lines[2].data, 'def', 'F - test_drop_file/lines:2')
check_eq(Lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
end
function test_adjust_line_width()
io.write('\ntest_adjust_line_width')
Filename = 'foo'