From aa55ad657b43bee229cdafd54bdcd1bfdc405a6b Mon Sep 17 00:00:00 2001 From: rohit Date: Tue, 3 Sep 2024 20:33:28 +0530 Subject: [PATCH] select all test fix --- .../test_multiple_flightpath_dockwidget.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/_test_msui/test_multiple_flightpath_dockwidget.py b/tests/_test_msui/test_multiple_flightpath_dockwidget.py index bf1404912..d25f84c17 100644 --- a/tests/_test_msui/test_multiple_flightpath_dockwidget.py +++ b/tests/_test_msui/test_multiple_flightpath_dockwidget.py @@ -187,6 +187,13 @@ def test_selectAll(main_window): """ main_window, multiple_flightpath_widget = main_window + # Activate the first flight track + activate_flight_track_at_index(main_window, 0) + + # Retrieve the index of the active flight track + active_item = main_window.listFlightTracks.currentItem() + active_index = main_window.listFlightTracks.row(active_item) + # Check the "Select All" checkbox select_all_checkbox = multiple_flightpath_widget.cbSlectAll1 select_all_checkbox.setCheckState(QtCore.Qt.Checked) @@ -196,12 +203,16 @@ def test_selectAll(main_window): item = multiple_flightpath_widget.list_flighttrack.item(i) assert item.checkState() == QtCore.Qt.Checked + # Uncheck the "Select All" checkbox select_all_checkbox.setCheckState(QtCore.Qt.Unchecked) - # Verify that all items in the list are unchecked + # Verify that all items except the active one are unchecked for i in range(multiple_flightpath_widget.list_flighttrack.count()): item = multiple_flightpath_widget.list_flighttrack.item(i) - assert item.checkState() == QtCore.Qt.Unchecked + if i == active_index: + assert item.checkState() == QtCore.Qt.Checked # Active item should remain checked + else: + assert item.checkState() == QtCore.Qt.Unchecked def test_random_custom_color_selection(main_window):