@@ -896,3 +896,84 @@ fn test_mouse_click_checkbox() -> eyre::Result<()> {
896
896
897
897
Ok ( ( ) )
898
898
}
899
+
900
+ #[ test]
901
+ fn test_mouse_click_wide_line ( ) -> eyre:: Result < ( ) > {
902
+ let state = RecordState {
903
+ files : vec ! [ File {
904
+ path: Cow :: Borrowed ( Path :: new( "foo" ) ) ,
905
+ file_mode: None ,
906
+ sections: vec![
907
+ Section :: FileMode {
908
+ is_toggled: false ,
909
+ before: FileMode :: absent( ) ,
910
+ after: FileMode ( 0o100644 ) ,
911
+ } ,
912
+ Section :: Changed {
913
+ lines: vec![ SectionChangedLine {
914
+ is_toggled: false ,
915
+ change_type: ChangeType :: Removed ,
916
+ line: Cow :: Borrowed ( "foo\n " ) ,
917
+ } ] ,
918
+ } ,
919
+ ] ,
920
+ } ] ,
921
+ } ;
922
+
923
+ let initial = TestingScreenshot :: default ( ) ;
924
+ let click_line = TestingScreenshot :: default ( ) ;
925
+ let click_line_section = TestingScreenshot :: default ( ) ;
926
+ let click_file_mode_section = TestingScreenshot :: default ( ) ;
927
+ let click_file = TestingScreenshot :: default ( ) ;
928
+ let event_source = EventSource :: testing (
929
+ 80 ,
930
+ 4 ,
931
+ [
932
+ initial. event ( ) ,
933
+ Event :: Click { row : 3 , column : 50 } ,
934
+ click_line. event ( ) ,
935
+ Event :: Click { row : 2 , column : 50 } ,
936
+ click_line_section. event ( ) ,
937
+ Event :: Click { row : 1 , column : 50 } ,
938
+ click_file_mode_section. event ( ) ,
939
+ Event :: Click { row : 0 , column : 50 } ,
940
+ click_file. event ( ) ,
941
+ Event :: QuitAccept ,
942
+ ] ,
943
+ ) ;
944
+ let recorder = Recorder :: new ( state, event_source) ;
945
+ recorder. run ( ) ?;
946
+
947
+ insta:: assert_display_snapshot!( initial, @r###"
948
+ "( ) foo "
949
+ " [ ] File mode changed from 0 to 100644 "
950
+ " [ ] Section 2/2 "
951
+ " [ ] - foo "
952
+ "### ) ;
953
+ insta:: assert_display_snapshot!( click_line, @r###"
954
+ "[ ] foo "
955
+ " [ ] File mode changed from 0 to 100644 "
956
+ " [ ] Section 2/2 "
957
+ " ( ) - foo "
958
+ "### ) ;
959
+ insta:: assert_display_snapshot!( click_line_section, @r###"
960
+ "[ ] foo "
961
+ " [ ] File mode changed from 0 to 100644 "
962
+ " ( ) Section 2/2 "
963
+ " [ ] - foo "
964
+ "### ) ;
965
+ insta:: assert_display_snapshot!( click_file_mode_section, @r###"
966
+ "[ ] foo "
967
+ " ( ) File mode changed from 0 to 100644 "
968
+ " [ ] Section 2/2 "
969
+ " [ ] - foo "
970
+ "### ) ;
971
+ insta:: assert_display_snapshot!( click_file, @r###"
972
+ "( ) foo "
973
+ " [ ] File mode changed from 0 to 100644 "
974
+ " [ ] Section 2/2 "
975
+ " [ ] - foo "
976
+ "### ) ;
977
+
978
+ Ok ( ( ) )
979
+ }
0 commit comments