update some deisng parameters and add new cases

This commit is contained in:
2026-07-29 14:32:22 -07:00
parent 683697604a
commit 45a77885f9
34 changed files with 4602 additions and 79 deletions
+53 -14
View File
@@ -6,20 +6,8 @@ require_relative "test_helper"
class WizardTest < Minitest::Test
def test_minimal_new_case_flow_and_confirmation
input = StringIO.new(
"Demo Case\n" \
"\n" \
"1\n" \
"1\n" \
"\n" \
"n\n" \
"n\n" \
"n\n" \
"1\n" \
"n\n" \
"n\n" \
"n\n" \
"n\n" \
"y\n"
["Demo Case", "", "1", "1", "", "n", "n", "", "", "n", "n", "1",
"n", "n", "n", "n", "y"].join("\n") + "\n"
)
output = StringIO.new
wizard = FeatherCaseWizard::Wizard.new(ui: HighLine.new(input, output))
@@ -31,4 +19,55 @@ class WizardTest < Minitest::Test
assert_equal ["3mf"], config.outputs["formats"]
assert_equal %w[body lid], config.printable_parts
end
def test_edit_accepts_current_menu_choices_as_defaults
config = FeatherCaseWizard::Config.create(name: "GPS", slug: "gps")
config.parameters["top_profile"] = "gps"
input = StringIO.new(
["", "", "", "", "n", "n", "", "", "n", "n", "1", "n", "n", "n",
"n"].join("\n") + "\n"
)
wizard = FeatherCaseWizard::Wizard.new(ui: HighLine.new(input, StringIO.new))
edited = wizard.edit(config)
assert_equal ["3mf"], edited.outputs["formats"]
assert_equal "gps", edited.parameters["top_profile"]
end
def test_edit_cutout_accepts_current_wall_and_shape_as_defaults
config = FeatherCaseWizard::Config.create(name: "GPS", slug: "gps")
cutout = {
"name" => "cable",
"face" => "left",
"shape" => "roundrect",
"horizontal" => 30.0,
"z" => 12.0,
"width" => 8.0,
"height" => 6.0,
"radius" => 1.5
}
output = StringIO.new
wizard = FeatherCaseWizard::Wizard.new(ui: HighLine.new(StringIO.new("\n" * 8), output))
edited = wizard.send(:ask_cutout, config, cutout)
assert_equal "left", edited["face"]
assert_equal "roundrect", edited["shape"]
assert_includes output.string, "Wall:\n1. Front — USB-C short wall\n"
assert_includes output.string, "3. Left — plain/non-JST long wall\n"
refute_includes output.string, "5. Wall"
end
def test_end_clearance_step_sets_both_board_end_distances
config = FeatherCaseWizard::Config.create(name: "Servo", slug: "servo")
wizard = FeatherCaseWizard::Wizard.new(
ui: HighLine.new(StringIO.new("y\n20\n20\n"), StringIO.new)
)
wizard.send(:choose_end_clearance, config)
assert_in_delta 20.0, config.parameters["usb_board_wall_gap"], 0.001
assert_in_delta 20.0, config.parameters["board_rear_clearance"], 0.001
end
end