case updates
This commit is contained in:
+75
-2
@@ -72,6 +72,26 @@ class ConfigTest < Minitest::Test
|
||||
assert_match(/guide requires/, error.message)
|
||||
end
|
||||
|
||||
def test_usb_opening_expands_upward_without_moving_bottom_edge
|
||||
parameters = config.parameters
|
||||
compensation = parameters["hole_compensation"]
|
||||
board_top = config.dimensions["floor"] +
|
||||
parameters["board_bottom_clearance"] + 1.6
|
||||
old_center = board_top + 1.6
|
||||
old_width = 12.5 + compensation
|
||||
old_height = 7.0 + compensation
|
||||
new_center = old_center + parameters["usb_vertical_offset"]
|
||||
new_width = parameters["usb_opening_width"] + compensation
|
||||
new_height = parameters["usb_opening_height"] + compensation
|
||||
|
||||
assert_in_delta 1.0, new_width - old_width, 0.001
|
||||
assert_in_delta old_center - old_height / 2,
|
||||
new_center - new_height / 2, 0.001
|
||||
assert_in_delta 1.0,
|
||||
(new_center + new_height / 2) -
|
||||
(old_center + old_height / 2), 0.001
|
||||
end
|
||||
|
||||
def test_end_clearances_expand_case_length
|
||||
subject = config
|
||||
subject.parameters["usb_board_wall_gap"] = 20.0
|
||||
@@ -109,6 +129,19 @@ class ConfigTest < Minitest::Test
|
||||
refute_includes source, "bore_d = diameter + hole_compensation;"
|
||||
end
|
||||
|
||||
def test_lid_rocker_mirrors_to_installed_feather_side
|
||||
source = FeatherCaseWizard::MODEL_SOURCE.read
|
||||
|
||||
assert_includes source,
|
||||
"rocker_lid_center_y = case_width - rocker_installed_center_y;"
|
||||
assert_includes source,
|
||||
"translate([rocker_lid_center_x, rocker_lid_center_y, -eps])"
|
||||
assert_includes source,
|
||||
"rocker_installed_center_y - rocker_body_size[1] / 2"
|
||||
assert_includes source,
|
||||
"+ rocker_body_size[1] / 2 + rocker_partition_offset;"
|
||||
end
|
||||
|
||||
def test_oled_buttons_and_selected_coupons_are_printable
|
||||
subject = config
|
||||
subject.parameters["top_profile"] = "oled128x64"
|
||||
@@ -125,10 +158,50 @@ class ConfigTest < Minitest::Test
|
||||
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 61.06, subject.dimensions["width"], 0.01
|
||||
assert_in_delta 31.25, subject.dimensions["height"], 0.01
|
||||
end
|
||||
|
||||
def test_battery_board_clearance_moves_the_whole_bay_outward
|
||||
subject = config
|
||||
subject.parameters["battery_enabled"] = true
|
||||
original_width = subject.dimensions["width"]
|
||||
|
||||
subject.parameters["battery_board_clearance"] += 2.0
|
||||
|
||||
assert_in_delta 2.0, subject.dimensions["width"] - original_width, 0.001
|
||||
end
|
||||
|
||||
def test_switch_tab_relief_uses_two_mm_lands_in_lid_and_coupon
|
||||
source = FeatherCaseWizard::MODEL_SOURCE.read
|
||||
|
||||
assert_in_delta 2.0, config.parameters["rocker_tab_panel_thickness"], 0.001
|
||||
assert_in_delta 2.0, config.parameters["rocker_tab_land"], 0.001
|
||||
assert_includes source, "module rocker_tab_reliefs(center, opening_size)"
|
||||
assert_equal 2, source.scan(/rocker_tab_reliefs\(/).length - 1
|
||||
assert_includes source,
|
||||
"edge_y = center[1] + side * opening_size[1] / 2;"
|
||||
assert_includes source,
|
||||
"opening_overlap = rocker_corner_radius;"
|
||||
assert_includes source,
|
||||
"cube([opening_size[0], rocker_tab_land + opening_overlap,"
|
||||
refute_includes source,
|
||||
"edge_x = center[0] + side * opening_size[0] / 2;"
|
||||
end
|
||||
|
||||
def test_switch_moves_two_mm_toward_partition_on_installed_lid
|
||||
assert_in_delta 2.0, config.parameters["rocker_partition_offset"], 0.001
|
||||
end
|
||||
|
||||
def test_switch_tab_panel_must_be_thinner_than_lid
|
||||
subject = config
|
||||
subject.parameters["rocker_tab_panel_thickness"] =
|
||||
subject.parameters["lid_thickness"]
|
||||
|
||||
error = assert_raises(FeatherCaseWizard::ConfigError) { subject.validate! }
|
||||
assert_match(/rocker_tab_panel_thickness/, error.message)
|
||||
end
|
||||
|
||||
def test_legacy_round_switch_fields_migrate_to_rocker_defaults
|
||||
data = config.data
|
||||
data["parameters"]["switch_hole_diameter"] = 12.0
|
||||
@@ -232,7 +305,7 @@ class ConfigTest < Minitest::Test
|
||||
|
||||
def test_front_cutout_can_clear_usb_reservation
|
||||
subject = config
|
||||
subject.data["cutouts"] = [cutout("front", 10.0).merge("z" => 11.0)]
|
||||
subject.data["cutouts"] = [cutout("front", 8.0).merge("z" => 11.0)]
|
||||
|
||||
assert_same subject, subject.validate!
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user