Skip to content

Commit

Permalink
Correct GUI state emulation (#1422)
Browse files Browse the repository at this point in the history
  • Loading branch information
roomrys authored Jul 31, 2023
1 parent e94b516 commit 3a01ef3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/gui/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,12 @@ def assert_frame_chunk_suggestion_ui_updated(

# Set up to test labeled frames data cache
app.labels = min_tracks_2node_labels
video = app.labels.video
video_clip = app.labels.video
app.state["labels"] = app.labels
app.state["video"] = video_clip
app.on_data_update([UpdateTopic.all])
num_samples = 5
frame_delta = video.num_frames // num_samples
frame_delta = video_clip.num_frames // num_samples

# Add suggestions
app.labels.suggestions = VideoFrameSuggestions.suggest(
Expand Down Expand Up @@ -274,7 +277,7 @@ def assert_frame_chunk_suggestion_ui_updated(
(l_suggestion.video, l_suggestion.frame_idx), use_cache=True
)
assert type(lf) == LabeledFrame
assert lf.video == video
assert lf.video == video_clip
assert lf.frame_idx == prev_idx + frame_delta
prev_idx = l_suggestion.frame_idx

Expand All @@ -284,8 +287,6 @@ def assert_frame_chunk_suggestion_ui_updated(

assert len(app.labels.videos) == 2

app.state["video"] = centered_pair_vid

# Generate suggested frames in both videos
app.labels.clear_suggestions()
num_samples = 3
Expand All @@ -311,11 +312,11 @@ def assert_frame_chunk_suggestion_ui_updated(
assert app.state["selected_video"] == small_robot_mp4_vid
app.commands.removeVideo()
assert len(app.labels.videos) == 1
assert app.state["video"] == centered_pair_vid
assert app.state["video"] == video_clip

# Verify frame suggestions from video 1 are removed
for sugg in app.labels.suggestions:
assert sugg.video == app.labels.videos[0]
assert sugg.video == video_clip


def test_app_new_window(qtbot):
Expand Down

0 comments on commit 3a01ef3

Please sign in to comment.