mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
richedit: Correct limitations on values for setting zoom ratio.
This commit is contained in:
parent
fcabbbf30f
commit
b81144b350
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user