test_force_operations
Tests for force operations functionality in user interactions.
This module tests the force option dialog and the force parameter behavior when performing operations like adding nodes and edges that would normally fail due to conflicts.
Classes
Functions
|
Create event values to simulate a paint event |
|
Test confirm_force_operation for each button and print which was clicked. |
|
Test paint event processing |
|
Test paint event processing |
|
Test paint event processing |
Module Contents
- test_force_operations.create_event_val(tp: int, z: tuple[int], y: tuple[int], x: tuple[int], old_val: int, target_val: int) list[tuple[tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray], numpy.ndarray, int]]
Create event values to simulate a paint event
- test_force_operations.test_confirm_force_operation_all_buttons(qtbot, monkeypatch, button_index, expected)
Test confirm_force_operation for each button and print which was clicked.
- test_force_operations.test_on_paint_invalid_action_upstream_division1_forceable(make_napari_viewer, graph_3d, segmentation_3d, monkeypatch, confirm_response, expect_force_retry)
Test paint event processing
- Paint with a the track_id (3) of node 4, at the time point of node 2. This is
technically invalid, because node 2 has already divided upstream. Therefore, the force dialog should pop up.
- (Control) Setting tracks_viewer.selected_track to None should allow painting with
a new track_id, therefore, no InvalidActionError should be raised, and no dialog should be triggered.
TP 0 1 1 Control: 1 1
| | |- 1 2 -1-> 2 5 2 -2-> 2 5
/ (force) / | / / 2 3 4 3 4 3 4 3 4
- test_force_operations.test_on_paint_invalid_action_upstream_division2_forceable(make_napari_viewer, graph_3d, segmentation_3d, monkeypatch, confirm_response, expect_force_retry)
Test paint event processing
- Paint with the track_id of node 2 at time point 2. This is invalid, because node 2
has already divided at time point 1.
- (Control) Setting tracks_viewer.selected_track to None should allow painting with
a new track_id.
- 0 1 1 Control: 1 1
- | | |
- 1 2 -1-> 2 2 -2-> 2
/ (force) | / / 2 3 4 3 5 4 3 4 3 4 5
- test_force_operations.test_invalid_edge_force(make_napari_viewer, graph_3d, segmentation_3d, monkeypatch, confirm_response, expect_force_retry)
Test paint event processing
Add a new, disconnected node (5)
- Create an edge between node 5 and 4. This is invalid, because 4 already has an
incoming edge. Therefore, the force dialog should be triggered.
TP 0 1 1 1
| |- 1 2 -1-> 2 5 -2-> 2 5
/ / (force) | |
2 3 4 3 4 3 4