@@ -4422,6 +4422,43 @@ static void test_EM_EXSETSEL(void)
4422
4422
DestroyWindow (hwndRichEdit );
4423
4423
}
4424
4424
4425
+ static void check_EM_SETSEL (HWND hwnd , const struct exsetsel_s * setsel , int id ) {
4426
+ LRESULT result ;
4427
+ int start , end ;
4428
+
4429
+ result = SendMessageA (hwnd , EM_SETSEL , setsel -> min , setsel -> max );
4430
+
4431
+ ok (result == setsel -> expected_retval , "EM_SETSEL(%d): expected: %ld actual: %ld\n" , id , setsel -> expected_retval , result );
4432
+
4433
+ SendMessageA (hwnd , EM_GETSEL , (WPARAM )& start , (LPARAM )& end );
4434
+
4435
+ if (setsel -> _getsel_todo_wine ) {
4436
+ todo_wine {
4437
+ ok (start == setsel -> expected_getsel_start && end == setsel -> expected_getsel_end , "EM_SETSEL(%d): expected (%d,%d) actual:(%d,%d)\n" , id , setsel -> expected_getsel_start , setsel -> expected_getsel_end , start , end );
4438
+ }
4439
+ } else {
4440
+ ok (start == setsel -> expected_getsel_start && end == setsel -> expected_getsel_end , "EM_SETSEL(%d): expected (%d,%d) actual:(%d,%d)\n" , id , setsel -> expected_getsel_start , setsel -> expected_getsel_end , start , end );
4441
+ }
4442
+ }
4443
+
4444
+ static void test_EM_SETSEL (void )
4445
+ {
4446
+ HWND hwndRichEdit = new_richedit (NULL );
4447
+ int i ;
4448
+ const int num_tests = sizeof (exsetsel_tests )/sizeof (struct exsetsel_s );
4449
+
4450
+ /* sending some text to the window */
4451
+ SendMessageA (hwndRichEdit , WM_SETTEXT , 0 , (LPARAM )"testing selection" );
4452
+ /* 01234567890123456*/
4453
+ /* 10 */
4454
+
4455
+ for (i = 0 ; i < num_tests ; i ++ ) {
4456
+ check_EM_SETSEL (hwndRichEdit , & exsetsel_tests [i ], i );
4457
+ }
4458
+
4459
+ DestroyWindow (hwndRichEdit );
4460
+ }
4461
+
4425
4462
static void test_EM_REPLACESEL (int redraw )
4426
4463
{
4427
4464
HWND hwndRichEdit = new_richedit (NULL );
@@ -7626,6 +7663,7 @@ START_TEST( editor )
7626
7663
test_EM_GETLIMITTEXT ();
7627
7664
test_WM_SETFONT ();
7628
7665
test_EM_GETMODIFY ();
7666
+ test_EM_SETSEL ();
7629
7667
test_EM_EXSETSEL ();
7630
7668
test_WM_PASTE ();
7631
7669
test_EM_STREAMIN ();
0 commit comments