diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 47e4af1cbbf..565d4670842 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -1230,18 +1230,19 @@ ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator) { /* TODO: Zoom images and objects */ - if (numerator != 0) + if (numerator == 0 && denominator == 0) { - if (denominator == 0) - return FALSE; - if (1.0 / 64.0 > (float)numerator / (float)denominator - || (float)numerator / (float)denominator > 64.0) - return FALSE; + editor->nZoomNumerator = editor->nZoomDenominator = 0; + return TRUE; } - + if (numerator <= 0 || denominator <= 0) + return FALSE; + if (numerator * 64 <= denominator || numerator / denominator >= 64) + return FALSE; + editor->nZoomNumerator = numerator; editor->nZoomDenominator = denominator; - + ME_RewrapRepaint(editor); return TRUE; } diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 4165f5ef144..633620ba4ad 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -6376,27 +6376,27 @@ static void test_zoom(void) ok(ret == TRUE, "EM_SETZOOM rejected valid values (%d).\n", ret); ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)2, (LPARAM)128); - todo_wine ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret); + ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret); ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator); - todo_wine ok(numerator == 127, "incorrect numerator is %d\n", numerator); - todo_wine ok(denominator == 2, "incorrect denominator is %d\n", denominator); + ok(numerator == 127, "incorrect numerator is %d\n", numerator); + ok(denominator == 2, "incorrect denominator is %d\n", denominator); ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret); ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)128, (LPARAM)2); - todo_wine ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret); + ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret); /* See if negative numbers are accepted. */ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)-100, (LPARAM)-100); - todo_wine ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret); + ok(ret == FALSE, "EM_SETZOOM accepted invalid values (%d).\n", ret); /* See if negative numbers are accepted. */ ret = SendMessage(hwnd, EM_SETZOOM, (WPARAM)0, (LPARAM)100); - todo_wine ok(ret == FALSE, "EM_SETZOOM failed (%d).\n", ret); + ok(ret == FALSE, "EM_SETZOOM failed (%d).\n", ret); ret = SendMessage(hwnd, EM_GETZOOM, (WPARAM)&numerator, (LPARAM)&denominator); - todo_wine ok(numerator == 127, "incorrect numerator is %d\n", numerator); - todo_wine ok(denominator == 2, "incorrect denominator is %d\n", denominator); + ok(numerator == 127, "incorrect numerator is %d\n", numerator); + ok(denominator == 2, "incorrect denominator is %d\n", denominator); ok(ret == TRUE, "EM_GETZOOM failed (%d).\n", ret); /* Reset the zoom value */