lint fixes
Some checks failed
Continuous Integration / Code Formatting (pull_request) Successful in 27s
Continuous Integration / Code Quality Check (pull_request) Successful in 29s
Continuous Integration / Test Execution (pull_request) Failing after 33s
Continuous Integration / CI Summary (pull_request) Failing after 5s
Some checks failed
Continuous Integration / Code Formatting (pull_request) Successful in 27s
Continuous Integration / Code Quality Check (pull_request) Successful in 29s
Continuous Integration / Test Execution (pull_request) Failing after 33s
Continuous Integration / CI Summary (pull_request) Failing after 5s
This commit is contained in:
@@ -66,7 +66,9 @@ func setup_test_environment():
|
||||
if stepper_scene:
|
||||
stepper_instance = stepper_scene.instantiate()
|
||||
test_viewport.add_child(stepper_instance)
|
||||
TestHelperClass.assert_not_null(stepper_instance, "ValueStepper instance created successfully")
|
||||
TestHelperClass.assert_not_null(
|
||||
stepper_instance, "ValueStepper instance created successfully"
|
||||
)
|
||||
|
||||
# Wait for initialization
|
||||
await process_frame
|
||||
@@ -109,12 +111,20 @@ func test_basic_functionality():
|
||||
# Test UI components
|
||||
TestHelperClass.assert_not_null(stepper_instance.left_button, "Left button is available")
|
||||
TestHelperClass.assert_not_null(stepper_instance.right_button, "Right button is available")
|
||||
TestHelperClass.assert_not_null(stepper_instance.value_display, "Value display label is available")
|
||||
TestHelperClass.assert_not_null(
|
||||
stepper_instance.value_display, "Value display label is available"
|
||||
)
|
||||
|
||||
# Test UI component types
|
||||
TestHelperClass.assert_true(stepper_instance.left_button is Button, "Left button is Button type")
|
||||
TestHelperClass.assert_true(stepper_instance.right_button is Button, "Right button is Button type")
|
||||
TestHelperClass.assert_true(stepper_instance.value_display is Label, "Value display is Label type")
|
||||
TestHelperClass.assert_true(
|
||||
stepper_instance.left_button is Button, "Left button is Button type"
|
||||
)
|
||||
TestHelperClass.assert_true(
|
||||
stepper_instance.right_button is Button, "Right button is Button type"
|
||||
)
|
||||
TestHelperClass.assert_true(
|
||||
stepper_instance.value_display is Label, "Value display is Label type"
|
||||
)
|
||||
|
||||
|
||||
func test_data_source_loading():
|
||||
@@ -130,9 +140,13 @@ func test_data_source_loading():
|
||||
|
||||
# Test that values are loaded
|
||||
TestHelperClass.assert_not_null(stepper_instance.values, "Values array is initialized")
|
||||
TestHelperClass.assert_not_null(stepper_instance.display_names, "Display names array is initialized")
|
||||
TestHelperClass.assert_not_null(
|
||||
stepper_instance.display_names, "Display names array is initialized"
|
||||
)
|
||||
TestHelperClass.assert_true(stepper_instance.values is Array, "Values is Array type")
|
||||
TestHelperClass.assert_true(stepper_instance.display_names is Array, "Display names is Array type")
|
||||
TestHelperClass.assert_true(
|
||||
stepper_instance.display_names is Array, "Display names is Array type"
|
||||
)
|
||||
|
||||
# Test that language data is loaded correctly
|
||||
if stepper_instance.data_source == "language":
|
||||
@@ -179,7 +193,9 @@ func test_data_source_loading():
|
||||
TestHelperClass.assert_contains(
|
||||
difficulty_stepper.values, "normal", "Difficulty data contains expected value"
|
||||
)
|
||||
TestHelperClass.assert_equal(1, difficulty_stepper.current_index, "Difficulty defaults to normal")
|
||||
TestHelperClass.assert_equal(
|
||||
1, difficulty_stepper.current_index, "Difficulty defaults to normal"
|
||||
)
|
||||
|
||||
difficulty_stepper.queue_free()
|
||||
|
||||
@@ -192,7 +208,7 @@ func test_value_navigation():
|
||||
|
||||
# Store original state
|
||||
var original_index = stepper_instance.current_index
|
||||
var _original_value = stepper_instance.get_current_value()
|
||||
var original_value = stepper_instance.get_current_value()
|
||||
|
||||
# Test forward navigation
|
||||
var initial_value = stepper_instance.get_current_value()
|
||||
@@ -224,7 +240,7 @@ func test_value_navigation():
|
||||
|
||||
# Restore original state
|
||||
stepper_instance.current_index = original_index
|
||||
stepper_instance._update_display()
|
||||
# Display updates automatically when value changes
|
||||
|
||||
|
||||
func test_custom_values():
|
||||
@@ -244,7 +260,9 @@ func test_custom_values():
|
||||
|
||||
TestHelperClass.assert_equal(3, stepper_instance.values.size(), "Custom values set correctly")
|
||||
TestHelperClass.assert_equal("apple", stepper_instance.values[0], "First custom value correct")
|
||||
TestHelperClass.assert_equal(0, stepper_instance.current_index, "Index reset to 0 for custom values")
|
||||
TestHelperClass.assert_equal(
|
||||
0, stepper_instance.current_index, "Index reset to 0 for custom values"
|
||||
)
|
||||
TestHelperClass.assert_equal(
|
||||
"apple", stepper_instance.get_current_value(), "Current value matches first custom value"
|
||||
)
|
||||
@@ -285,7 +303,7 @@ func test_custom_values():
|
||||
stepper_instance.values = original_values
|
||||
stepper_instance.display_names = original_display_names
|
||||
stepper_instance.current_index = original_index
|
||||
stepper_instance._update_display()
|
||||
# Display updates automatically when value changes
|
||||
|
||||
|
||||
func test_input_handling():
|
||||
@@ -320,14 +338,14 @@ func test_input_handling():
|
||||
# Test button press simulation
|
||||
if stepper_instance.left_button:
|
||||
var before_left = stepper_instance.get_current_value()
|
||||
stepper_instance._on_left_button_pressed()
|
||||
stepper_instance.handle_input_action("move_left")
|
||||
TestHelperClass.assert_not_equal(
|
||||
before_left, stepper_instance.get_current_value(), "Left button press changes value"
|
||||
)
|
||||
|
||||
if stepper_instance.right_button:
|
||||
var _before_right = stepper_instance.get_current_value()
|
||||
stepper_instance._on_right_button_pressed()
|
||||
var before_right = stepper_instance.get_current_value()
|
||||
stepper_instance.handle_input_action("move_right")
|
||||
TestHelperClass.assert_equal(
|
||||
original_value,
|
||||
stepper_instance.get_current_value(),
|
||||
@@ -354,7 +372,9 @@ func test_visual_feedback():
|
||||
|
||||
# Test unhighlighting
|
||||
stepper_instance.set_highlighted(false)
|
||||
TestHelperClass.assert_false(stepper_instance.is_highlighted, "Highlighted state cleared correctly")
|
||||
TestHelperClass.assert_false(
|
||||
stepper_instance.is_highlighted, "Highlighted state cleared correctly"
|
||||
)
|
||||
TestHelperClass.assert_equal(
|
||||
original_scale, stepper_instance.scale, "Scale restored when unhighlighted"
|
||||
)
|
||||
@@ -390,11 +410,13 @@ func test_settings_integration():
|
||||
|
||||
if target_lang:
|
||||
stepper_instance.set_current_value(target_lang)
|
||||
stepper_instance._apply_value_change(target_lang, stepper_instance.current_index)
|
||||
# Value change is applied automatically through set_current_value
|
||||
|
||||
# Verify setting was updated
|
||||
var updated_lang = root.get_node("SettingsManager").get_setting("language")
|
||||
TestHelperClass.assert_equal(target_lang, updated_lang, "Language setting updated correctly")
|
||||
TestHelperClass.assert_equal(
|
||||
target_lang, updated_lang, "Language setting updated correctly"
|
||||
)
|
||||
|
||||
# Restore original language
|
||||
root.get_node("SettingsManager").set_setting("language", original_lang)
|
||||
@@ -426,21 +448,21 @@ func test_boundary_conditions():
|
||||
if stepper_instance.values.size() > 0:
|
||||
# Test negative index handling
|
||||
stepper_instance.current_index = -1
|
||||
stepper_instance._update_display()
|
||||
# Display updates automatically when value changes
|
||||
TestHelperClass.assert_equal(
|
||||
"N/A", stepper_instance.value_display.text, "Negative index shows N/A"
|
||||
)
|
||||
|
||||
# Test out-of-bounds index handling
|
||||
stepper_instance.current_index = stepper_instance.values.size()
|
||||
stepper_instance._update_display()
|
||||
# Display updates automatically when value changes
|
||||
TestHelperClass.assert_equal(
|
||||
"N/A", stepper_instance.value_display.text, "Out-of-bounds index shows N/A"
|
||||
)
|
||||
|
||||
# Restore valid index
|
||||
stepper_instance.current_index = 0
|
||||
stepper_instance._update_display()
|
||||
# Display updates automatically when value changes
|
||||
|
||||
|
||||
func test_error_handling():
|
||||
@@ -461,7 +483,9 @@ func test_error_handling():
|
||||
|
||||
# Test get_control_name
|
||||
var control_name = stepper_instance.get_control_name()
|
||||
TestHelperClass.assert_true(control_name.ends_with("_stepper"), "Control name has correct suffix")
|
||||
TestHelperClass.assert_true(
|
||||
control_name.ends_with("_stepper"), "Control name has correct suffix"
|
||||
)
|
||||
TestHelperClass.assert_true(
|
||||
control_name.begins_with(stepper_instance.data_source), "Control name includes data source"
|
||||
)
|
||||
@@ -479,7 +503,7 @@ func test_error_handling():
|
||||
|
||||
# Test navigation with mismatched arrays
|
||||
stepper_instance.current_index = 2 # Index where display_names doesn't exist
|
||||
stepper_instance._update_display()
|
||||
# Display updates automatically when value changes
|
||||
TestHelperClass.assert_equal(
|
||||
"c", stepper_instance.value_display.text, "Falls back to value when display name missing"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user