From 612c43f3b1c0351fe2601ed73024d39bacd4ed52 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 18 Mar 2020 22:43:27 -0400 Subject: Added `ui.dialogs.progressbar()` and utilize it with Find in Files. --- test/test.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/test.lua') 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 -- cgit v1.2.3