[1/3] gdi32: Initial Gamma setting tests

André Hentschel nerv at dawncrow.de
Wed Aug 10 15:58:46 CDT 2011


---
 dlls/gdi32/tests/dc.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index 5017583..f8ceccd 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -24,6 +24,7 @@
 #include <assert.h>
 #include <stdio.h>
 
+#include "ddraw.h"
 #include "wine/test.h"
 #include "winbase.h"
 #include "wingdi.h"
@@ -599,6 +600,44 @@ static void test_desktop_colorres(void)
     ReleaseDC(NULL, hdc);
 }
 
+static void test_gamma(void)
+{
+    BOOL ret;
+    HDC hdc = GetDC(NULL);
+    DDGAMMARAMP oldramp;
+
+    ret = GetDeviceGammaRamp(hdc, &oldramp);
+
+    if (ret)
+    {
+        DDGAMMARAMP ramp;
+        ZeroMemory(&ramp, sizeof(ramp));
+
+        /* ramps are zero for every color */
+        ret = SetDeviceGammaRamp(hdc, &ramp);
+        todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n");
+
+        /* set a ramp part at the end of every color to non-zero */
+        ramp.red[255] = 1;
+        ramp.green[255] = 1;
+        ramp.blue[255] = 1;
+        ret = SetDeviceGammaRamp(hdc, &ramp);
+        todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n");
+
+        /* set a ramp part in the middle of one color to non-zero */
+        ramp.blue[127] = 1;
+        ret = SetDeviceGammaRamp(hdc, &ramp);
+        todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n");
+
+        /* cleanup: set old ramp */
+        ret = SetDeviceGammaRamp(hdc, &oldramp);
+        ok(ret || broken(!ret), "SetDeviceGammaRamp failed\n");
+    }
+    else win_skip("GetDeviceGammaRamp failed, skipping tests\n");
+
+    ReleaseDC(NULL, hdc);
+}
+
 START_TEST(dc)
 {
     test_savedc();
@@ -609,4 +648,5 @@ START_TEST(dc)
     test_DeleteDC();
     test_boundsrect_invalid();
     test_desktop_colorres();
+    test_gamma();
 }
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list