From cad5b98e1beb25ff4f8c91b55aef3713c67b24eb Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Tue, 12 May 2009 15:24:07 +0000 Subject: [PATCH] Extend Auto 4 Lua config dialogues test case to cover most interesting cases of controls. Updates #775 and #776 since they need those cases. Originally committed to SVN as r2911. --- .../automation/tests/config-dialog-test.lua | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/aegisub/automation/tests/config-dialog-test.lua b/aegisub/automation/tests/config-dialog-test.lua index acc6bcacf..d09a2e091 100644 --- a/aegisub/automation/tests/config-dialog-test.lua +++ b/aegisub/automation/tests/config-dialog-test.lua @@ -12,7 +12,28 @@ function test7(subtitles, selected_lines, active_line) local a, b = aegisub.dialog.display({{class="label", label="Test..."}}, {}) report_dialog_result(a, b) aegisub.progress.set(50) - a, b = aegisub.dialog.display({{class="edit", name="foo", text=""}}, {"foo", "bar"}) + a, b = aegisub.dialog.display( + { + {class="edit", name="foo", text="", x=0, y=0}, + {class="intedit", name="e1", value=20, x=0, y=1}, + {class="intedit", name="e2", value=30, min=10, max=50, x=1, y=1}, + {class="floatedit", name="e3", value=19.95, x=0, y=2}, + {class="floatedit", name="e4", value=123.63423, min=-4.3, max=2091, x=1, y=2}, + {class="floatedit", name="e5", value=-4, step=0.21, x=2, y=2}, + {class="floatedit", name="e6", value=22, min=0, max=100, step=1.4, x=3, y=2}, + {class="textbox", name="e7", text="hmm wuzzis say?", x=0, y=3, width=4}, + {class="dropdown", name="l1", items={"abc", "def", "ghi"}, value="def", x=0, y=4}, + {class="dropdown", name="l2", items={"abc", "def", "ghi"}, value="doesnotexist", x=1, y=4}, + {class="checkbox", name="b1", value=true, label='checked', x=0, y=5}, + {class="checkbox", name="b2", value=false, label='cleared', x=1, y=5}, + {class="color", name="c1", value="#00ff11", x=0, y=6}, + {class="color", name="c2", value="&H0011ff00", x=1, y=6}, + {class="coloralpha", name="c3", value="#aabbccdd", x=0, y=7}, + {class="coloralpha", name="c4", value="&Hddccbbaa&", x=1, y=7}, + {class="alpha", name="c5", value="#12", x=0, y=8}, + {class="alpha", name="c6", value="&H12&", x=1, y=8} + }, + {"foo", "bar"}) report_dialog_result(a, b) end @@ -26,7 +47,8 @@ function report_dialog_result(button, controls) aegisub.debug.out("clicked '" .. button .. "'\n") end for key, val in pairs(controls) do - aegisub.debug.out(key .. ': ' .. val .. '\n') + local printable = (val == true and "true") or (val == false and "false") or tostring(val) + aegisub.debug.out("%s: %s\n", key, printable) end aegisub.debug.out(" - - - - -\n") end