@@ -9143,5 +9143,36 @@ public void Cell_LoadCells_Without_Scheme_Is_Never_Null ()
9143
9143
}
9144
9144
}
9145
9145
9146
+ [ Fact ]
9147
+ [ TextViewTestsAutoInitShutdown ]
9148
+ public void IsSelecting_False_If_SelectedLength_Is_Zero_On_Mouse_Click ( )
9149
+ {
9150
+ _textView . Text = "This is the first line." ;
9151
+ var top = new Toplevel ( ) ;
9152
+ top . Add ( _textView ) ;
9153
+ Application . Begin ( top ) ;
9154
+
9155
+ Application . RaiseMouseEvent ( new ( ) { ScreenPosition = new ( 22 , 0 ) , Flags = MouseFlags . Button1Pressed } ) ;
9156
+ Assert . Equal ( 22 , _textView . CursorPosition . X ) ;
9157
+ Assert . Equal ( 0 , _textView . CursorPosition . Y ) ;
9158
+ Assert . Equal ( 0 , _textView . SelectedLength ) ;
9159
+ Assert . True ( _textView . IsSelecting ) ;
9160
+
9161
+ Application . RaiseMouseEvent ( new ( ) { ScreenPosition = new ( 22 , 0 ) , Flags = MouseFlags . Button1Released } ) ;
9162
+ Assert . Equal ( 22 , _textView . CursorPosition . X ) ;
9163
+ Assert . Equal ( 0 , _textView . CursorPosition . Y ) ;
9164
+ Assert . Equal ( 0 , _textView . SelectedLength ) ;
9165
+ Assert . True ( _textView . IsSelecting ) ;
9166
+
9167
+ Application . RaiseMouseEvent ( new ( ) { ScreenPosition = new ( 22 , 0 ) , Flags = MouseFlags . Button1Clicked } ) ;
9168
+ Assert . Equal ( 22 , _textView . CursorPosition . X ) ;
9169
+ Assert . Equal ( 0 , _textView . CursorPosition . Y ) ;
9170
+ Assert . Equal ( 0 , _textView . SelectedLength ) ;
9171
+ Assert . False ( _textView . IsSelecting ) ;
9172
+
9173
+ top . Dispose ( ) ;
9174
+ Application . Shutdown ( ) ;
9175
+ }
9176
+
9146
9177
private TextView CreateTextView ( ) { return new ( ) { Width = 30 , Height = 10 } ; }
9147
9178
}
0 commit comments