aboutsummaryrefslogtreecommitdiff
path: root/test/test.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-03-18 22:43:27 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-03-18 22:43:27 -0400
commit612c43f3b1c0351fe2601ed73024d39bacd4ed52 (patch)
treee8b422252d6ee8e9ed9790ab0b7732049f992c7b /test/test.lua
parent9b02a146612e1a2e15b7bb8d2a5185f1d3925572 (diff)
downloadtextadept-612c43f3b1c0351fe2601ed73024d39bacd4ed52.tar.gz
textadept-612c43f3b1c0351fe2601ed73024d39bacd4ed52.zip
Added `ui.dialogs.progressbar()` and utilize it with Find in Files.
Diffstat (limited to 'test/test.lua')
-rw-r--r--test/test.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index b884f188..78291350 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -908,6 +908,33 @@ function test_ui_dialogs_optionselect_interactive()
assert_raises(function() ui.dialogs.optionselect{items = {'foo', 'bar', 'baz'}, select = {1, 'bar'}} end, "bad argument #select[2] to 'optionselect' (number expected, got string")
end
+function test_ui_dialogs_progressbar_interactive()
+ local i = 0
+ ui.dialogs.progressbar({title = 'foo'}, function()
+ os.execute('sleep 0.1')
+ i = i + 10
+ if i > 100 then return nil end
+ return i, i .. '%'
+ end)
+
+ local stopped = ui.dialogs.progressbar({
+ title = 'foo', indeterminite = true, stoppable = true
+ }, function()
+ os.execute('sleep 0.1')
+ return 50
+ end)
+ assert(stopped, 'progressbar not stopped')
+
+ ui.update() -- allow GTK to remove callback for previous function
+ i = 0
+ ui.dialogs.progressbar({title = 'foo', stoppable = true}, function()
+ os.execute('sleep 0.1')
+ i = i + 10
+ if i > 100 then return nil end
+ return i, i <= 50 and "stop disable" or "stop enable"
+ end)
+end
+
function test_ui_dialogs_textbox_interactive()
ui.dialogs.textbox{
text = 'foo', editable = true, selected = true, monospaced_font = true