@@ -762,3 +762,98 @@ def test_that_design_matrix_show_parameters_button_is_visible(
762
762
assert isinstance (show_dm_parameters , QPushButton )
763
763
else :
764
764
assert show_dm_parameters is None
765
+
766
+
767
+ @pytest .mark .parametrize (
768
+ "events,tab_widget_count" ,
769
+ [
770
+ pytest .param (
771
+ [
772
+ FullSnapshotEvent (
773
+ snapshot = (
774
+ SnapshotBuilder ()
775
+ .add_fm_step (
776
+ fm_step_id = "0" ,
777
+ index = "0" ,
778
+ name = "fm_step_0" ,
779
+ status = state .FORWARD_MODEL_STATE_START ,
780
+ )
781
+ .build (["0" , "1" ], state .REALIZATION_STATE_UNKNOWN )
782
+ ),
783
+ iteration_label = "Foo" ,
784
+ total_iterations = 1 ,
785
+ progress = 0.5 ,
786
+ realization_count = 2 ,
787
+ status_count = {"Finished" : 1 , "Pending" : 1 },
788
+ iteration = 0 ,
789
+ ),
790
+ FullSnapshotEvent (
791
+ snapshot = (
792
+ SnapshotBuilder ()
793
+ .add_fm_step (
794
+ fm_step_id = "0" ,
795
+ index = "0" ,
796
+ name = "fm_step_0" ,
797
+ status = state .FORWARD_MODEL_STATE_START ,
798
+ )
799
+ .build (["0" , "1" ], state .REALIZATION_STATE_FINISHED )
800
+ ),
801
+ iteration_label = "Foo" ,
802
+ total_iterations = 1 ,
803
+ progress = 0.5 ,
804
+ realization_count = 2 ,
805
+ status_count = {"Finished" : 1 , "Pending" : 1 },
806
+ iteration = 1 ,
807
+ ),
808
+ EndEvent (failed = False , msg = "" ),
809
+ ],
810
+ 2 ,
811
+ id = "changing from between tabs" ,
812
+ ),
813
+ ],
814
+ )
815
+ def test_forward_model_overview_label_selected_on_tab_change (
816
+ events , tab_widget_count , qtbot : QtBot , event_queue , run_dialog
817
+ ):
818
+ run_dialog .run_experiment ()
819
+ for event in events :
820
+ event_queue .put (event )
821
+
822
+ def qt_bot_click_realization (realization_index : int , iteration : int ) -> None :
823
+ view = run_dialog ._tab_widget .widget (iteration )._real_view
824
+ model_index = view .model ().index (realization_index , 0 )
825
+ view .scrollTo (model_index )
826
+ rect = view .visualRect (model_index )
827
+ click_pos = rect .center ()
828
+ qtbot .mouseClick (view .viewport (), Qt .LeftButton , pos = click_pos )
829
+
830
+ def qt_bot_click_tab_index (tab_index : int ) -> None :
831
+ tab_bar = run_dialog ._tab_widget .tabBar ()
832
+ tab_rect = tab_bar .tabRect (tab_index )
833
+ click_pos = tab_rect .center ()
834
+ qtbot .mouseClick (tab_bar , Qt .LeftButton , pos = click_pos )
835
+
836
+ # verify two tabs present
837
+ qtbot .waitUntil (
838
+ lambda : run_dialog ._tab_widget .count () == tab_widget_count , timeout = 5000
839
+ )
840
+ qtbot .waitUntil (lambda : run_dialog .is_simulation_done () == True , timeout = 5000 )
841
+
842
+ qt_bot_click_tab_index (0 )
843
+ fm_step_label = run_dialog .findChild (QLabel , name = "fm_step_label" )
844
+ assert "Realization id 0 in iteration 0" in fm_step_label .text ()
845
+
846
+ qt_bot_click_realization (1 , 0 )
847
+ assert "Realization id 1 in iteration 0" in fm_step_label .text ()
848
+
849
+ qt_bot_click_tab_index (1 )
850
+ assert "Realization id 0 in iteration 1" in fm_step_label .text ()
851
+
852
+ qt_bot_click_realization (1 , 1 )
853
+ assert "Realization id 1 in iteration 1" in fm_step_label .text ()
854
+
855
+ qt_bot_click_tab_index (0 )
856
+ assert "Realization id 1 in iteration 0" in fm_step_label .text ()
857
+
858
+ qt_bot_click_tab_index (1 )
859
+ assert "Realization id 1 in iteration 1" in fm_step_label .text ()
0 commit comments