mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-31 03:11:59 +08:00
Properly assign properties during the test setup and bind event.
This commit is contained in:
parent
dc48ebea78
commit
cdb7053034
@ -10,7 +10,9 @@ UI_Color::UI_Color(wxWindow* parent, Slic3r::ConfigOptionDef _opt ) : UI_Window(
|
||||
}
|
||||
this->_picker = new wxColourPickerCtrl(parent, wxID_ANY, default_color, wxDefaultPosition, this->_default_size());
|
||||
this->window = dynamic_cast<wxWindow*>(this->_picker);
|
||||
|
||||
|
||||
this->_picker->Bind(wxEVT_COLOURPICKER_CHANGED, [this](wxColourPickerEvent& e) { this->_on_change(""); e.Skip(); });
|
||||
|
||||
}
|
||||
|
||||
void UI_Color::set_value(boost::any value) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "ConfigBase.hpp"
|
||||
using namespace std::string_literals;
|
||||
|
||||
SCENARIO( "UI_ColorPick: default values from options and basic accessor methods") {
|
||||
SCENARIO("UI_Color: default values from options and basic accessor methods") {
|
||||
wxTestableFrame* old = dynamic_cast<wxTestableFrame*>(wxTheApp->GetTopWindow());
|
||||
old->Destroy();
|
||||
wxTheApp->SetTopWindow(new wxTestableFrame());
|
||||
@ -25,7 +25,10 @@ SCENARIO( "UI_ColorPick: default values from options and basic accessor methods"
|
||||
auto event_count {0};
|
||||
auto changefunc {[&event_count] (const std::string& opt_id, const std::string& color) { event_count++; }};
|
||||
GIVEN("A Color Picker") {
|
||||
simple_option.default_value = default_color;
|
||||
auto test_field {Slic3r::GUI::UI_Color(wxTheApp->GetTopWindow(), simple_option)};
|
||||
|
||||
test_field.on_change = changefunc;
|
||||
WHEN("Object is constructed with default_value of '#FFFF00'.") {
|
||||
THEN("get_string() returns '#FFFF00'") {
|
||||
REQUIRE(test_field.get_string() == "#FFFF00"s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user