Pluciński Mariusz : gameux: Add implementation of IGameStatistics::GetCategoryTitle.

Alexandre Julliard julliard at winehq.org
Fri Nov 5 13:47:16 CDT 2010


Module: wine
Branch: master
Commit: ff9e31a2b56ed73efdb4f7b52209d102ee24c52e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ff9e31a2b56ed73efdb4f7b52209d102ee24c52e

Author: Pluciński Mariusz <vshader at gmail.com>
Date:   Thu Nov  4 16:36:56 2010 +0100

gameux: Add implementation of IGameStatistics::GetCategoryTitle.

---

 dlls/gameux/gamestatistics.c       |   25 +++++++++++++++++++++++--
 dlls/gameux/tests/gamestatistics.c |   14 +++++++-------
 2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/dlls/gameux/gamestatistics.c b/dlls/gameux/gamestatistics.c
index 2d9dd7f..2807c9e 100644
--- a/dlls/gameux/gamestatistics.c
+++ b/dlls/gameux/gamestatistics.c
@@ -807,8 +807,29 @@ static HRESULT WINAPI GameStatisticsImpl_GetCategoryTitle(
     WORD categoryIndex,
     LPWSTR *pTitle)
 {
-    FIXME("stub\n");
-    return E_NOTIMPL;
+    HRESULT hr = S_OK;
+    LONG nLength;
+    GameStatisticsImpl *This = impl_from_IGameStatistics(iface);
+
+    TRACE("%p, %d, %p\n", This, categoryIndex, pTitle);
+
+    *pTitle = NULL;
+
+    if(!pTitle || categoryIndex >= MAX_CATEGORIES)
+        hr = E_INVALIDARG;
+
+
+    if(SUCCEEDED(hr))
+    {
+        nLength = lstrlenW(This->stats.categories[categoryIndex].sName);
+        if(nLength != 0)
+        {
+            *pTitle = CoTaskMemAlloc(sizeof(WCHAR)*(nLength+1));
+            lstrcpyW(*pTitle, This->stats.categories[categoryIndex].sName);
+        }
+    }
+
+    return hr;
 }
 
 static HRESULT WINAPI GameStatisticsImpl_GetStatistic(
diff --git a/dlls/gameux/tests/gamestatistics.c b/dlls/gameux/tests/gamestatistics.c
index 3f5d5d2..a2d0616 100644
--- a/dlls/gameux/tests/gamestatistics.c
+++ b/dlls/gameux/tests/gamestatistics.c
@@ -346,23 +346,23 @@ static void test_gamestatisticsmgr( void )
 
         /* verify values with these which we stored before*/
         hr = IGameStatistics_GetCategoryTitle(gs, 0, &lpName);
-        todo_wine ok(hr == S_OK, "getting category title failed\n");
-        todo_wine ok(lstrcmpW(lpName, sCategory0)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
+        ok(hr == S_OK, "getting category title failed\n");
+        ok(lstrcmpW(lpName, sCategory0)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
         CoTaskMemFree(lpName);
 
         hr = IGameStatistics_GetCategoryTitle(gs, 1, &lpName);
-        todo_wine ok(hr == S_OK, "getting category title failed\n");
-        todo_wine ok(lstrcmpW(lpName, sCategory1)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
+        ok(hr == S_OK, "getting category title failed\n");
+        ok(lstrcmpW(lpName, sCategory1)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
         CoTaskMemFree(lpName);
 
         hr = IGameStatistics_GetCategoryTitle(gs, 2, &lpName);
-        todo_wine ok(hr == S_OK, "getting category title failed\n");
-        todo_wine ok(lstrcmpW(lpName, sCategory2)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
+        ok(hr == S_OK, "getting category title failed\n");
+        ok(lstrcmpW(lpName, sCategory2)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
         CoTaskMemFree(lpName);
 
         /* check result if category doesn't exists */
         hr = IGameStatistics_GetCategoryTitle(gs, 3, &lpName);
-        todo_wine ok(hr == S_OK, "getting category title failed\n");
+        ok(hr == S_OK, "getting category title failed\n");
         ok(lpName == NULL, "getting category title failed\n");
         CoTaskMemFree(lpName);
 




More information about the wine-cvs mailing list