Module: wine Branch: master Commit: b81144b35075911afbd92e2e523582b55b0db58b URL: http://source.winehq.org/git/wine.git/?a=commit;h=b81144b35075911afbd92e2e52...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Tue Jan 13 13:39:39 2009 -0500
richedit: Correct limitations on values for setting zoom ratio.
---
dlls/riched20/paint.c | 17 +++++++++-------- dlls/riched20/tests/editor.c | 16 ++++++++-------- 2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 47e4af1..565d467 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 4165f5e..633620b 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 */