summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_toolbars.lua
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/scripts/lua/test_toolbars.lua')
-rw-r--r--indra/newview/scripts/lua/test_toolbars.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/test_toolbars.lua b/indra/newview/scripts/lua/test_toolbars.lua
new file mode 100644
index 0000000000..9a832c5644
--- /dev/null
+++ b/indra/newview/scripts/lua/test_toolbars.lua
@@ -0,0 +1,28 @@
+popup = require 'popup'
+UI = require 'UI'
+
+local OK = 'OK_okcancelbuttons'
+local BUTTONS = UI.getToolbarBtnNames()
+local TOOLBARS = {'left','right','bottom'}
+
+-- Clear the toolbars and then add the toolbar buttons to the random toolbar
+response = popup:alertYesCancel('Toolbars will be randomly reshuffled. Proceed?')
+if next(response) == OK then
+ UI.clearAllToolbars()
+ math.randomseed(os.time())
+
+ -- add the buttons to the random toolbar
+ for i = 1, #BUTTONS do
+ UI.addToolbarBtn(BUTTONS[i], TOOLBARS[math.random(3)])
+ end
+
+ -- remove some of the added buttons from the toolbars
+ for i = 1, #BUTTONS do
+ if math.random(100) < 30 then
+ UI.removeToolbarBtn(BUTTONS[i])
+ end
+ end
+ popup:tip('Toolbars were reshuffled')
+else
+ popup:tip('Canceled')
+end