tweak the fit of the parts

This commit is contained in:
Nick Estes
2026-08-04 12:27:31 -07:00
parent 45a77885f9
commit 69d9b956e6
41 changed files with 5378 additions and 324 deletions
+94
View File
@@ -80,6 +80,35 @@ class ConfigTest < Minitest::Test
assert_in_delta 95.6, subject.dimensions["length"], 0.01
end
def test_insert_defaults_match_selected_hardware
parameters = config.parameters
assert_in_delta 4.0, parameters["m25_insert_length"], 0.001
assert_in_delta 3.1, parameters["m25_insert_hole_diameter"], 0.001
assert_in_delta 3.5, parameters["m25_insert_outer_diameter"], 0.001
assert_in_delta 5.0, parameters["tripod_insert_length"], 0.001
assert_in_delta 7.2, parameters["tripod_insert_hole_diameter"], 0.001
assert_in_delta 8.0, parameters["tripod_insert_outer_diameter"], 0.001
end
def test_tripod_floor_tracks_insert_length
subject = config
subject.parameters["tripod_insert_enabled"] = true
assert_in_delta 7.0, subject.dimensions["floor"], 0.001
end
def test_insert_coupon_uses_finished_pilot_ranges
source = FeatherCaseWizard::MODEL_SOURCE.read
assert_includes source,
"m25_coupon_steps = [-0.15, -0.075, 0, 0.075, 0.15];"
assert_includes source,
"tripod_coupon_steps = [-0.3, -0.15, 0, 0.15, 0.3];"
assert_includes source, "bore_d = diameter;"
refute_includes source, "bore_d = diameter + hole_compensation;"
end
def test_oled_buttons_and_selected_coupons_are_printable
subject = config
subject.parameters["top_profile"] = "oled128x64"
@@ -90,6 +119,71 @@ class ConfigTest < Minitest::Test
assert_equal %w[body lid buttons fit_coupon], subject.printable_parts
end
def test_combined_battery_and_tripod_case_adds_partition_clearance
subject = config
subject.parameters["battery_enabled"] = true
subject.parameters["tripod_insert_enabled"] = true
assert_in_delta 88.6, subject.dimensions["length"], 0.01
assert_in_delta 59.06, subject.dimensions["width"], 0.01
assert_in_delta 31.25, subject.dimensions["height"], 0.01
end
def test_legacy_round_switch_fields_migrate_to_rocker_defaults
data = config.data
data["parameters"]["switch_hole_diameter"] = 12.0
data["parameters"]["switch_body_length"] = 24.0
subject = FeatherCaseWizard::Config.new(data)
refute subject.parameters.key?("switch_hole_diameter")
refute subject.parameters.key?("switch_body_length")
assert_equal [12.9, 19.4], subject.parameters["rocker_cutout_size"]
assert_equal [15.0, 21.0, 21.0], subject.parameters["rocker_body_size"]
end
def test_battery_partition_requires_three_06_mm_lines
subject = config
subject.parameters["battery_partition_thickness"] = 1.19
error = assert_raises(FeatherCaseWizard::ConfigError) { subject.validate! }
assert_match(/battery_partition_thickness/, error.message)
end
def test_insert_entry_cannot_be_smaller_than_pilot
subject = config
subject.parameters["m25_insert_outer_diameter"] = 3.0
error = assert_raises(FeatherCaseWizard::ConfigError) { subject.validate! }
assert_match(/m25_insert_outer_diameter/, error.message)
end
def test_lid_artwork_adds_base_and_accent_parts
subject = config
subject.parameters["lid_label"] = "GPS"
subject.parameters["lid_logo_enabled"] = true
assert subject.lid_artwork?
assert_equal %w[body lid lid_base lid_accent], subject.printable_parts
end
def test_lid_artwork_rejects_oled_profile
subject = config
subject.parameters["top_profile"] = "oled128x64"
subject.parameters["lid_label"] = "OLED"
error = assert_raises(FeatherCaseWizard::ConfigError) { subject.validate! }
assert_match(/not supported with the OLED profile/, error.message)
end
def test_lid_artwork_orientation_is_named
subject = config
subject.parameters["lid_art_orientation"] = "diagonal"
error = assert_raises(FeatherCaseWizard::ConfigError) { subject.validate! }
assert_match(/orientation/, error.message)
end
def test_wall_local_cutouts_map_to_model_coordinates
subject = config
length = subject.dimensions["length"]