From e6ce0e9f26d563b4f3c2eb5aed7527419e093432 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 13 Mar 2015 11:59:26 +0300 Subject: [PATCH] dwrite: Fix GetClusterMetrics() return value. --- dlls/dwrite/layout.c | 2 +- dlls/dwrite/tests/layout.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 26d84a3089e..24fb5806381 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -1730,7 +1730,7 @@ static HRESULT WINAPI dwritetextlayout_GetClusterMetrics(IDWriteTextLayout2 *ifa memcpy(metrics, This->clusters, sizeof(DWRITE_CLUSTER_METRICS)*min(max_count, This->clusters_count)); *count = This->clusters_count; - return max_count < This->clusters_count ? S_OK : E_NOT_SUFFICIENT_BUFFER; + return max_count >= This->clusters_count ? S_OK : E_NOT_SUFFICIENT_BUFFER; } static HRESULT WINAPI dwritetextlayout_DetermineMinWidth(IDWriteTextLayout2 *iface, FLOAT* min_width) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index eb00e530951..a0de75eafb2 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -947,7 +947,6 @@ static void test_GetClusterMetrics(void) count = 0; hr = IDWriteTextLayout_GetClusterMetrics(layout, NULL, 0, &count); -todo_wine ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr); ok(count == 4, "got %u\n", count); @@ -962,10 +961,10 @@ todo_wine /* inline object takes a separate cluster, replaced codepoints number doesn't matter */ count = 0; hr = IDWriteTextLayout_GetClusterMetrics(layout, NULL, 0, &count); -todo_wine { ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr); +todo_wine ok(count == 3, "got %u\n", count); -} + IDWriteInlineObject_Release(trimm); IDWriteTextLayout_Release(layout); IDWriteTextFormat_Release(format);