From 5f8075585cd4256b00c6c8e70cb1320d41063725 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 18 Nov 2018 16:42:35 -0600 Subject: [PATCH] Move the incompatible to the file for consistency. --- src/test/GUI/test_preset_chooser.cpp | 46 +++++++++++++++++-- .../incompat-material-profile.ini | 25 ++++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 src/test/inputs/test_preset_chooser/incompat-material-profile.ini diff --git a/src/test/GUI/test_preset_chooser.cpp b/src/test/GUI/test_preset_chooser.cpp index 598e4a9c1..5d83f0f62 100644 --- a/src/test/GUI/test_preset_chooser.cpp +++ b/src/test/GUI/test_preset_chooser.cpp @@ -7,7 +7,7 @@ #include #include "testableframe.h" - +#include "Log.hpp" #include "Print.hpp" #include "Preset.hpp" @@ -46,9 +46,8 @@ std::array sample_compatible() { preset_list[get_preset(preset_t::Print)].push_back(Preset(testfile_dir + "test_preset_chooser"s, "print-profile.ini", preset_t::Print)); preset_list[get_preset(preset_t::Print)].push_back(Preset(true, "- default -", preset_t::Print)); - preset_list[get_preset(preset_t::Material)].push_back(Preset(testfile_dir + "test_preset_chooser"s, "material-profile.ini", preset_t::Material)); - // set the material to be compatible to printer-profile-2, not 1 - preset_list[get_preset(preset_t::Material)][0].config().lock()->get_ptr("compatible_printers"s)->values.push_back("printer-profile-2"s); + // set the material to be compatible to printer-profile-2 only + preset_list[get_preset(preset_t::Material)].push_back(Preset(testfile_dir + "test_preset_chooser"s, "incompat-material-profile.ini", preset_t::Material)); preset_list[get_preset(preset_t::Material)].push_back(Preset(true, "- default -", preset_t::Material)); preset_list[get_preset(preset_t::Printer)].push_back(Preset(true, "- default -", preset_t::Printer)); @@ -100,7 +99,44 @@ SCENARIO( "PresetChooser changed printer") { } THEN( "Selected material profile entry is \"material-profile\"" ) { for (auto* chooser : cut.preset_choosers[get_preset(preset_t::Material)]) { - REQUIRE(chooser->GetString(chooser->GetSelection()) == wxString("material-profile")); + REQUIRE(chooser->GetString(chooser->GetSelection()) == wxString("incompat-material-profile")); + } + } + } + WHEN( "Printer profile is changed to printer-profile-2 via combobox event" ) { + auto* printer_chooser = cut.preset_choosers[get_preset(preset_t::Printer)].at(0); + printer_chooser->SetSelection(0); + + auto ev {wxCommandEvent(wxEVT_COMBOBOX, printer_chooser->GetId())}; + ev.SetEventObject(printer_chooser); + Slic3r::Log::debug("test") << "Firing combobox event" << "\n"; + printer_chooser->ProcessWindowEvent(ev); + wxYield(); + wxMilliSleep(150); + + THEN( "Selected printer profile entry is \"printer-profile-2\"" ) { + for (auto* chooser : cut.preset_choosers[get_preset(preset_t::Printer)]) { + REQUIRE(chooser->GetString(chooser->GetSelection()) == wxString("printer-profile-2")); + } + } + THEN( "Print profile chooser has 1 entry" ) { + for (auto* chooser : cut.preset_choosers[get_preset(preset_t::Print)]) { + REQUIRE(chooser->GetCount() == 1); + } + } + THEN( "Selected print profile entry is \"print-profile\"" ) { + for (auto* chooser : cut.preset_choosers[get_preset(preset_t::Print)]) { + REQUIRE(chooser->GetString(chooser->GetSelection()) == wxString("print-profile")); + } + } + THEN( "Material profile chooser has one entry" ) { + for (auto* chooser : cut.preset_choosers[get_preset(preset_t::Material)]) { + REQUIRE(chooser->GetCount() == 1); + } + } + THEN( "Selected material profile entry is \"material-profile\"" ) { + for (auto* chooser : cut.preset_choosers[get_preset(preset_t::Material)]) { + REQUIRE(chooser->GetString(chooser->GetSelection()) == wxString("incompat-material-profile")); } } } diff --git a/src/test/inputs/test_preset_chooser/incompat-material-profile.ini b/src/test/inputs/test_preset_chooser/incompat-material-profile.ini new file mode 100644 index 000000000..583f0ee7c --- /dev/null +++ b/src/test/inputs/test_preset_chooser/incompat-material-profile.ini @@ -0,0 +1,25 @@ +# generated by Slic3r 1.3.0-dev on 2018-03-23 03:49:17 +bed_temperature = 70 +bridge_fan_speed = 100 +compatible_printers = printer-profile-2;nothing +cooling = 1 +disable_fan_first_layers = 4 +end_filament_gcode = "; Filament-specific end gcode \n;END gcode for filament\n" +extrusion_multiplier = 1 +fan_always_on = 1 +fan_below_layer_time = 10 +filament_colour = #4EFF00 +filament_cost = 30 +filament_density = 1.25 +filament_diameter = 1.73 +filament_max_volumetric_speed = 0 +filament_notes = "" +filament_settings_id = +first_layer_bed_temperature = 70 +first_layer_temperature = 220 +max_fan_speed = 100 +min_fan_speed = 100 +min_print_speed = 10 +slowdown_below_layer_time = 60 +start_filament_gcode = "; Filament gcode\n; ATOMIC PLA" +temperature = 218