mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-03 19:50:40 +08:00
all tests pass
This commit is contained in:
parent
20d3f69982
commit
880b17703d
@ -22,9 +22,9 @@ SCENARIO( "TextCtrl initializes with default value if available.") {
|
|||||||
wxMilliSleep(250);
|
wxMilliSleep(250);
|
||||||
|
|
||||||
Slic3r::ConfigOptionDef simple_option;
|
Slic3r::ConfigOptionDef simple_option;
|
||||||
simple_option.type = coInt;
|
simple_option.type = coString;
|
||||||
auto* intopt { new Slic3r::ConfigOptionInt(7) };
|
auto* stropt { new Slic3r::ConfigOptionString("7") };
|
||||||
simple_option.default_value = intopt; // no delete, it's taken care of by ConfigOptionDef
|
simple_option.default_value = stropt; // no delete, it's taken care of by ConfigOptionDef
|
||||||
GIVEN ( "A UI Textctrl") {
|
GIVEN ( "A UI Textctrl") {
|
||||||
auto test_field {Slic3r::GUI::UI_TextCtrl(wxTheApp->GetTopWindow(), simple_option)};
|
auto test_field {Slic3r::GUI::UI_TextCtrl(wxTheApp->GetTopWindow(), simple_option)};
|
||||||
|
|
||||||
@ -169,10 +169,10 @@ SCENARIO( "Multiline doesn't update other than on focus change.") {
|
|||||||
wxMilliSleep(500);
|
wxMilliSleep(500);
|
||||||
|
|
||||||
Slic3r::ConfigOptionDef simple_option;
|
Slic3r::ConfigOptionDef simple_option;
|
||||||
simple_option.type = coInt;
|
simple_option.type = coString;
|
||||||
simple_option.multiline = true;
|
simple_option.multiline = true;
|
||||||
auto* stropt { new Slic3r::ConfigOptionString("7") };
|
auto* stropt { new Slic3r::ConfigOptionString("7") };
|
||||||
GIVEN ( "A UI Textctrl") {
|
GIVEN ( "A multiline UI Textctrl") {
|
||||||
auto exec_counter {0};
|
auto exec_counter {0};
|
||||||
auto changefunc {[&exec_counter] (const std::string& opt_id, std::string value) { exec_counter++; }};
|
auto changefunc {[&exec_counter] (const std::string& opt_id, std::string value) { exec_counter++; }};
|
||||||
auto test_field {Slic3r::GUI::UI_TextCtrl(wxTheApp->GetTopWindow(), Slic3r::ConfigOptionDef())};
|
auto test_field {Slic3r::GUI::UI_TextCtrl(wxTheApp->GetTopWindow(), Slic3r::ConfigOptionDef())};
|
||||||
@ -181,7 +181,7 @@ SCENARIO( "Multiline doesn't update other than on focus change.") {
|
|||||||
|
|
||||||
wxTheApp->GetTopWindow()->Show();
|
wxTheApp->GetTopWindow()->Show();
|
||||||
wxTheApp->GetTopWindow()->Fit();
|
wxTheApp->GetTopWindow()->Fit();
|
||||||
WHEN( "pressing enter") {
|
WHEN( "text is entered and focus is lost") {
|
||||||
auto killfunc {[&exec_counter](const std::string& opt_id) { exec_counter += 1; }};
|
auto killfunc {[&exec_counter](const std::string& opt_id) { exec_counter += 1; }};
|
||||||
test_field.on_kill_focus = killfunc;
|
test_field.on_kill_focus = killfunc;
|
||||||
|
|
||||||
@ -189,14 +189,17 @@ SCENARIO( "Multiline doesn't update other than on focus change.") {
|
|||||||
ev.SetEventObject(test_field.textctrl());
|
ev.SetEventObject(test_field.textctrl());
|
||||||
|
|
||||||
exec_counter = 0;
|
exec_counter = 0;
|
||||||
test_field.textctrl()->SetValue("3");
|
|
||||||
test_field.textctrl()->SetFocus();
|
test_field.textctrl()->SetFocus();
|
||||||
wxYield();
|
wxYield();
|
||||||
wxMilliSleep(250);
|
wxMilliSleep(250);
|
||||||
|
sim.Char(WXK_LEFT);
|
||||||
|
sim.Char('7');
|
||||||
|
wxYield();
|
||||||
sim.Char('7');
|
sim.Char('7');
|
||||||
wxYield();
|
wxYield();
|
||||||
wxMilliSleep(250);
|
wxMilliSleep(250);
|
||||||
test_field.textctrl()->ProcessWindowEvent(ev);
|
test_field.textctrl()->ProcessWindowEvent(ev);
|
||||||
|
wxYield();
|
||||||
wxMilliSleep(250);
|
wxMilliSleep(250);
|
||||||
wxYield();
|
wxYield();
|
||||||
THEN( "on_kill_focus is executed and on_change are both executed.") {
|
THEN( "on_kill_focus is executed and on_change are both executed.") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user