ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
23 participants
435 discussions
Start a n
N
ew thread
[dchapyshev] 33897: - Add wine test for gdiplus
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sun Jun 8 04:47:47 2008 New Revision: 33897 URL:
http://svn.reactos.org/svn/reactos?rev=33897&view=rev
Log: - Add wine test for gdiplus Added: trunk/rostests/winetests/gdiplus/ trunk/rostests/winetests/gdiplus/brush.c (with props) trunk/rostests/winetests/gdiplus/font.c (with props) trunk/rostests/winetests/gdiplus/gdiplus.rbuild (with props) trunk/rostests/winetests/gdiplus/graphics.c (with props) trunk/rostests/winetests/gdiplus/graphicspath.c (with props) trunk/rostests/winetests/gdiplus/image.c (with props) trunk/rostests/winetests/gdiplus/matrix.c (with props) trunk/rostests/winetests/gdiplus/pen.c (with props) trunk/rostests/winetests/gdiplus/stringformat.c (with props) trunk/rostests/winetests/gdiplus/testlist.c (with props) Modified: trunk/rostests/winetests/directory.rbuild Modified: trunk/rostests/winetests/directory.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/directory.rbuil…
============================================================================== --- trunk/rostests/winetests/directory.rbuild [iso-8859-1] (original) +++ trunk/rostests/winetests/directory.rbuild [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -24,6 +24,9 @@ </directory> <directory name="gdi32"> <xi:include href="gdi32/gdi32.rbuild" /> + </directory> + <directory name="gdiplus"> + <xi:include href="gdiplus/gdiplus.rbuild" /> </directory> <directory name="hlink"> <xi:include href="hlink/hlink.rbuild" /> Added: trunk/rostests/winetests/gdiplus/brush.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/brush.c…
============================================================================== --- trunk/rostests/winetests/gdiplus/brush.c (added) +++ trunk/rostests/winetests/gdiplus/brush.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,74 @@ +/* + * Unit test suite for brushes + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#include "gdiplus.h" +#include "wine/test.h" + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) + +static void test_constructor_destructor(void) +{ + GpStatus status; + GpSolidFill *brush = NULL; + + status = GdipCreateSolidFill((ARGB)0xdeadbeef, &brush); + expect(Ok, status); + ok(brush != NULL, "Expected brush to be initialized\n"); + + status = GdipDeleteBrush(NULL); + expect(InvalidParameter, status); + + status = GdipDeleteBrush((GpBrush*) brush); + expect(Ok, status); +} + +static void test_type(void) +{ + GpStatus status; + GpBrushType bt; + GpSolidFill *brush = NULL; + + GdipCreateSolidFill((ARGB)0xdeadbeef, &brush); + + status = GdipGetBrushType((GpBrush*)brush, &bt); + expect(status, Ok); + expect(bt, BrushTypeSolidColor); + + GdipDeleteBrush((GpBrush*) brush); +} + +START_TEST(brush) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_constructor_destructor(); + test_type(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/brush.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/font.c?…
============================================================================== --- trunk/rostests/winetests/gdiplus/font.c (added) +++ trunk/rostests/winetests/gdiplus/font.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,112 @@ +/* + * Unit test suite for fonts + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#include "gdiplus.h" +#include "wine/test.h" + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) + +static WCHAR arial[] = {'A','r','i','a','l','\0'}; + +static void test_logfont(void) +{ + LOGFONTW lfw, lfw2; + GpFont *font; + GpStatus stat; + GpGraphics *graphics; + HDC hdc = GetDC(0); + + GdipCreateFromHDC(hdc, &graphics); + memset(&lfw, 0, sizeof(LOGFONTW)); + memset(&lfw2, 0xff, sizeof(LOGFONTW)); + memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR)); + + stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font); + expect(Ok, stat); + stat = GdipGetLogFontW(font, graphics, &lfw2); + expect(Ok, stat); + + ok(lfw2.lfHeight < 0, "Expected negative height\n"); + expect(0, lfw2.lfWidth); + expect(0, lfw2.lfEscapement); + expect(0, lfw2.lfOrientation); + ok((lfw2.lfWeight >= 100) && (lfw2.lfWeight <= 900), "Expected weight to be set\n"); + expect(0, lfw2.lfItalic); + expect(0, lfw2.lfUnderline); + expect(0, lfw2.lfStrikeOut); + expect(0, lfw2.lfCharSet); + expect(0, lfw2.lfOutPrecision); + expect(0, lfw2.lfClipPrecision); + expect(0, lfw2.lfQuality); + expect(0, lfw2.lfPitchAndFamily); + + GdipDeleteFont(font); + + memset(&lfw, 0, sizeof(LOGFONTW)); + lfw.lfHeight = 25; + lfw.lfWidth = 25; + lfw.lfEscapement = lfw.lfOrientation = 50; + lfw.lfItalic = lfw.lfUnderline = lfw.lfStrikeOut = TRUE; + + memset(&lfw2, 0xff, sizeof(LOGFONTW)); + memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR)); + + stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font); + expect(Ok, stat); + stat = GdipGetLogFontW(font, graphics, &lfw2); + expect(Ok, stat); + + ok(lfw2.lfHeight < 0, "Expected negative height\n"); + expect(0, lfw2.lfWidth); + expect(0, lfw2.lfEscapement); + expect(0, lfw2.lfOrientation); + ok((lfw2.lfWeight >= 100) && (lfw2.lfWeight <= 900), "Expected weight to be set\n"); + expect(TRUE, lfw2.lfItalic); + expect(TRUE, lfw2.lfUnderline); + expect(TRUE, lfw2.lfStrikeOut); + expect(0, lfw2.lfCharSet); + expect(0, lfw2.lfOutPrecision); + expect(0, lfw2.lfClipPrecision); + expect(0, lfw2.lfQuality); + expect(0, lfw2.lfPitchAndFamily); + + GdipDeleteFont(font); + + GdipDeleteGraphics(graphics); + ReleaseDC(0, hdc); +} + +START_TEST(font) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_logfont(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/font.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/gdiplus.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/gdiplus…
============================================================================== --- trunk/rostests/winetests/gdiplus/gdiplus.rbuild (added) +++ trunk/rostests/winetests/gdiplus/gdiplus.rbuild [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,22 @@ +<module name="gdiplus_winetest" type="win32cui" installbase="bin" installname="gdiplus_winetest.exe" allowwarnings="true"> + <include base="gdiplus_winetest">.</include> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <define name="WINVER">0x501</define> + <library>wine</library> + <library>gdiplus</library> + <library>user32</library> + <library>gdi32</library> + <library>kernel32</library> + <library>ntdll</library> + <file>brush.c</file> + <file>font.c</file> + <file>graphics.c</file> + <file>graphicspath.c</file> + <file>image.c</file> + <file>matrix.c</file> + <file>pen.c</file> + <file>stringformat.c</file> + <file>testlist.c</file> +</module> Propchange: trunk/rostests/winetests/gdiplus/gdiplus.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/graphics.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/graphic…
============================================================================== --- trunk/rostests/winetests/gdiplus/graphics.c (added) +++ trunk/rostests/winetests/gdiplus/graphics.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,476 @@ +/* + * Unit test suite for graphics objects + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#include "gdiplus.h" +#include "wingdi.h" +#include "wine/test.h" + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) +#define TABLE_LEN (23) + +static void test_constructor_destructor(void) +{ + GpStatus stat; + GpGraphics *graphics = NULL; + HDC hdc = GetDC(0); + + stat = GdipCreateFromHDC(NULL, &graphics); + expect(OutOfMemory, stat); + stat = GdipDeleteGraphics(graphics); + expect(InvalidParameter, stat); + + stat = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, stat); + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipCreateFromHWND(NULL, &graphics); + expect(Ok, stat); + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipCreateFromHWNDICM(NULL, &graphics); + expect(Ok, stat); + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipDeleteGraphics(NULL); + expect(InvalidParameter, stat); + ReleaseDC(0, hdc); +} + +typedef struct node{ + GraphicsState data; + struct node * next; +} node; + +/* Linked list prepend function. */ +static void log_state(GraphicsState data, node ** log) +{ + node * new_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(node)); + + new_entry->data = data; + new_entry->next = *log; + *log = new_entry; +} + +/* Checks if there are duplicates in the list, and frees it. */ +static void check_no_duplicates(node * log) +{ + INT dups = 0; + node * temp = NULL; + node * temp2 = NULL; + node * orig = log; + + if(!log) + goto end; + + do{ + temp = log; + while((temp = temp->next)){ + if(log->data == temp->data){ + dups++; + break; + } + if(dups > 0) + break; + } + }while((log = log->next)); + + temp = orig; + do{ + temp2 = temp->next; + HeapFree(GetProcessHeap(), 0, temp); + temp = temp2; + }while(temp); + +end: + expect(0, dups); +} + +static void test_save_restore(void) +{ + GpStatus stat; + GraphicsState state_a, state_b, state_c; + InterpolationMode mode; + GpGraphics *graphics1, *graphics2; + node * state_log = NULL; + HDC hdc = GetDC(0); + state_a = state_b = state_c = 0xdeadbeef; + + /* Invalid saving. */ + GdipCreateFromHDC(hdc, &graphics1); + stat = GdipSaveGraphics(graphics1, NULL); + expect(InvalidParameter, stat); + stat = GdipSaveGraphics(NULL, &state_a); + expect(InvalidParameter, stat); + GdipDeleteGraphics(graphics1); + + log_state(state_a, &state_log); + + /* Basic save/restore. */ + GdipCreateFromHDC(hdc, &graphics1); + GdipSetInterpolationMode(graphics1, InterpolationModeBilinear); + stat = GdipSaveGraphics(graphics1, &state_a); + todo_wine + expect(Ok, stat); + GdipSetInterpolationMode(graphics1, InterpolationModeBicubic); + stat = GdipRestoreGraphics(graphics1, state_a); + todo_wine + expect(Ok, stat); + GdipGetInterpolationMode(graphics1, &mode); + todo_wine + expect(InterpolationModeBilinear, mode); + GdipDeleteGraphics(graphics1); + + log_state(state_a, &state_log); + + /* Restoring garbage doesn't affect saves. */ + GdipCreateFromHDC(hdc, &graphics1); + GdipSetInterpolationMode(graphics1, InterpolationModeBilinear); + GdipSaveGraphics(graphics1, &state_a); + GdipSetInterpolationMode(graphics1, InterpolationModeBicubic); + GdipSaveGraphics(graphics1, &state_b); + GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor); + stat = GdipRestoreGraphics(graphics1, 0xdeadbeef); + todo_wine + expect(Ok, stat); + GdipRestoreGraphics(graphics1, state_b); + GdipGetInterpolationMode(graphics1, &mode); + todo_wine + expect(InterpolationModeBicubic, mode); + GdipRestoreGraphics(graphics1, state_a); + GdipGetInterpolationMode(graphics1, &mode); + todo_wine + expect(InterpolationModeBilinear, mode); + GdipDeleteGraphics(graphics1); + + log_state(state_a, &state_log); + log_state(state_b, &state_log); + + /* Restoring older state invalidates newer saves (but not older saves). */ + GdipCreateFromHDC(hdc, &graphics1); + GdipSetInterpolationMode(graphics1, InterpolationModeBilinear); + GdipSaveGraphics(graphics1, &state_a); + GdipSetInterpolationMode(graphics1, InterpolationModeBicubic); + GdipSaveGraphics(graphics1, &state_b); + GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor); + GdipSaveGraphics(graphics1, &state_c); + GdipSetInterpolationMode(graphics1, InterpolationModeHighQualityBilinear); + GdipRestoreGraphics(graphics1, state_b); + GdipGetInterpolationMode(graphics1, &mode); + todo_wine + expect(InterpolationModeBicubic, mode); + GdipRestoreGraphics(graphics1, state_c); + GdipGetInterpolationMode(graphics1, &mode); + todo_wine + expect(InterpolationModeBicubic, mode); + GdipRestoreGraphics(graphics1, state_a); + GdipGetInterpolationMode(graphics1, &mode); + todo_wine + expect(InterpolationModeBilinear, mode); + GdipDeleteGraphics(graphics1); + + log_state(state_a, &state_log); + log_state(state_b, &state_log); + log_state(state_c, &state_log); + + /* Restoring older save from one graphics object does not invalidate + * newer save from other graphics object. */ + GdipCreateFromHDC(hdc, &graphics1); + GdipCreateFromHDC(hdc, &graphics2); + GdipSetInterpolationMode(graphics1, InterpolationModeBilinear); + GdipSaveGraphics(graphics1, &state_a); + GdipSetInterpolationMode(graphics2, InterpolationModeBicubic); + GdipSaveGraphics(graphics2, &state_b); + GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor); + GdipSetInterpolationMode(graphics2, InterpolationModeNearestNeighbor); + GdipRestoreGraphics(graphics1, state_a); + GdipGetInterpolationMode(graphics1, &mode); + todo_wine + expect(InterpolationModeBilinear, mode); + GdipRestoreGraphics(graphics2, state_b); + GdipGetInterpolationMode(graphics2, &mode); + todo_wine + expect(InterpolationModeBicubic, mode); + GdipDeleteGraphics(graphics1); + GdipDeleteGraphics(graphics2); + + /* You can't restore a state to a graphics object that didn't save it. */ + GdipCreateFromHDC(hdc, &graphics1); + GdipCreateFromHDC(hdc, &graphics2); + GdipSetInterpolationMode(graphics1, InterpolationModeBilinear); + GdipSaveGraphics(graphics1, &state_a); + GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor); + GdipSetInterpolationMode(graphics2, InterpolationModeNearestNeighbor); + GdipRestoreGraphics(graphics2, state_a); + GdipGetInterpolationMode(graphics2, &mode); + expect(InterpolationModeNearestNeighbor, mode); + GdipDeleteGraphics(graphics1); + GdipDeleteGraphics(graphics2); + + log_state(state_a, &state_log); + + /* The same state value should never be returned twice. */ + todo_wine + check_no_duplicates(state_log); + + ReleaseDC(0, hdc); +} + +static void test_GdipDrawArc(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + GpPen *pen = NULL; + HDC hdc = GetDC(0); + + /* make a graphics object and pen object */ + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(hdc != NULL, "Expected HDC to be initialized\n"); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(graphics != NULL, "Expected graphics to be initialized\n"); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + /* InvalidParameter cases: null graphics, null pen, non-positive width, non-positive height */ + status = GdipDrawArc(NULL, NULL, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); + expect(InvalidParameter, status); + + status = GdipDrawArc(graphics, NULL, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0); + expect(InvalidParameter, status); + + status = GdipDrawArc(NULL, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0); + expect(InvalidParameter, status); + + status = GdipDrawArc(graphics, pen, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0); + expect(InvalidParameter, status); + + status = GdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0); + expect(InvalidParameter, status); + + /* successful case */ + status = GdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0); + expect(Ok, status); + + GdipDeletePen(pen); + ReleaseDC(0, hdc); +} + +static void test_GdipDrawArcI(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + GpPen *pen = NULL; + HDC hdc = GetDC(0); + + /* make a graphics object and pen object */ + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(hdc != NULL, "Expected HDC to be initialized\n"); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(graphics != NULL, "Expected graphics to be initialized\n"); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + /* InvalidParameter cases: null graphics, null pen, non-positive width, non-positive height */ + status = GdipDrawArcI(NULL, NULL, 0, 0, 0, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(graphics, NULL, 0, 0, 1, 1, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(NULL, pen, 0, 0, 1, 1, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(graphics, pen, 0, 0, 1, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawArcI(graphics, pen, 0, 0, 0, 1, 0, 0); + expect(InvalidParameter, status); + + /* successful case */ + status = GdipDrawArcI(graphics, pen, 0, 0, 1, 1, 0, 0); + expect(Ok, status); + + GdipDeletePen(pen); + ReleaseDC(0, hdc); +} + +static void test_GdipDrawBezierI(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + GpPen *pen = NULL; + HDC hdc = GetDC(0); + + /* make a graphics object and pen object */ + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(hdc != NULL, "Expected HDC to be initialized\n"); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(graphics != NULL, "Expected graphics to be initialized\n"); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + /* InvalidParameter cases: null graphics, null pen */ + status = GdipDrawBezierI(NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawBezierI(graphics, NULL, 0, 0, 0, 0, 0, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawBezierI(NULL, pen, 0, 0, 0, 0, 0, 0, 0, 0); + expect(InvalidParameter, status); + + /* successful case */ + status = GdipDrawBezierI(graphics, pen, 0, 0, 0, 0, 0, 0, 0, 0); + expect(Ok, status); + + GdipDeletePen(pen); + ReleaseDC(0, hdc); +} + +static void test_GdipDrawLineI(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + GpPen *pen = NULL; + HDC hdc = GetDC(0); + + /* make a graphics object and pen object */ + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(hdc != NULL, "Expected HDC to be initialized\n"); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(graphics != NULL, "Expected graphics to be initialized\n"); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + /* InvalidParameter cases: null graphics, null pen */ + status = GdipDrawLineI(NULL, NULL, 0, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawLineI(graphics, NULL, 0, 0, 0, 0); + expect(InvalidParameter, status); + + status = GdipDrawLineI(NULL, pen, 0, 0, 0, 0); + expect(InvalidParameter, status); + + /* successful case */ + status = GdipDrawLineI(graphics, pen, 0, 0, 0, 0); + expect(Ok, status); + + GdipDeletePen(pen); + ReleaseDC(0, hdc); +} + +static void test_GdipDrawLinesI(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + GpPen *pen = NULL; + GpPoint *ptf = NULL; + HDC hdc = GetDC(0); + + /* make a graphics object and pen object */ + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(hdc != NULL, "Expected HDC to be initialized\n"); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(graphics != NULL, "Expected graphics to be initialized\n"); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + /* make some arbitrary valid points*/ + ptf = GdipAlloc(2 * sizeof(GpPointF)); + + ptf[0].X = 1; + ptf[0].Y = 1; + + ptf[1].X = 2; + ptf[1].Y = 2; + + /* InvalidParameter cases: null graphics, null pen, null points, count < 2*/ + status = GdipDrawLinesI(NULL, NULL, NULL, 0); + expect(InvalidParameter, status); + + status = GdipDrawLinesI(graphics, pen, ptf, 0); + expect(InvalidParameter, status); + + status = GdipDrawLinesI(graphics, NULL, ptf, 2); + expect(InvalidParameter, status); + + status = GdipDrawLinesI(NULL, pen, ptf, 2); + expect(InvalidParameter, status); + + /* successful case */ + status = GdipDrawLinesI(graphics, pen, ptf, 2); + expect(Ok, status); + + GdipFree(ptf); + GdipDeletePen(pen); + ReleaseDC(0, hdc); +} + +START_TEST(graphics) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_constructor_destructor(); + test_save_restore(); + test_GdipDrawBezierI(); + test_GdipDrawArc(); + test_GdipDrawArcI(); + test_GdipDrawLineI(); + test_GdipDrawLinesI(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/graphics.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/graphicspath.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/graphic…
============================================================================== --- trunk/rostests/winetests/gdiplus/graphicspath.c (added) +++ trunk/rostests/winetests/gdiplus/graphicspath.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,598 @@ +/* + * Unit test suite for paths + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#include "gdiplus.h" +#include "wine/test.h" +#include <math.h> + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) +#define expectf(expected, got) ok(fabs(expected - got) < 2.0, "Expected %.2f, got %.2f\n", expected, got) +#define POINT_TYPE_MAX_LEN (75) + +static void stringify_point_type(PathPointType type, char * name) +{ + *name = '\0'; + + switch(type & PathPointTypePathTypeMask){ + case PathPointTypeStart: + strcat(name, "PathPointTypeStart"); + break; + case PathPointTypeLine: + strcat(name, "PathPointTypeLine"); + break; + case PathPointTypeBezier: + strcat(name, "PathPointTypeBezier"); + break; + default: + strcat(name, "Unknown type"); + return; + } + + type &= ~PathPointTypePathTypeMask; + if(type & ~((PathPointTypePathMarker | PathPointTypeCloseSubpath))){ + *name = '\0'; + strcat(name, "Unknown type"); + return; + } + + if(type & PathPointTypePathMarker) + strcat(name, " | PathPointTypePathMarker"); + if(type & PathPointTypeCloseSubpath) + strcat(name, " | PathPointTypeCloseSubpath"); +} + +/* this helper structure and function modeled after gdi path.c test */ +typedef struct +{ + REAL X, Y; + BYTE type; + + /* How many extra entries before this one only on wine + * but not on native? */ + int wine_only_entries_preceding; + + /* 0 - This entry matches on wine. + * 1 - This entry corresponds to a single entry on wine that does not match the native entry. + * 2 - This entry is currently skipped on wine but present on native. */ + int todo; +} path_test_t; + +static void ok_path(GpPath* path, const path_test_t *expected, INT expected_size, BOOL todo_size) +{ + BYTE * types; + INT size, idx = 0, eidx = 0, numskip; + GpPointF * points; + char ename[POINT_TYPE_MAX_LEN], name[POINT_TYPE_MAX_LEN]; + + if(GdipGetPointCount(path, &size) != Ok){ + skip("Cannot perform path comparisons due to failure to retrieve path.\n"); + return; + } + + if(todo_size) todo_wine + ok(size == expected_size, "Path size %d does not match expected size %d\n", + size, expected_size); + else + ok(size == expected_size, "Path size %d does not match expected size %d\n", + size, expected_size); + + points = HeapAlloc(GetProcessHeap(), 0, size * sizeof(GpPointF)); + types = HeapAlloc(GetProcessHeap(), 0, size); + + if(GdipGetPathPoints(path, points, size) != Ok || GdipGetPathTypes(path, types, size) != Ok){ + skip("Cannot perform path comparisons due to failure to retrieve path.\n"); + goto end; + } + + numskip = expected_size ? expected[eidx].wine_only_entries_preceding : 0; + while (idx < size && eidx < expected_size){ + /* We allow a few pixels fudge in matching X and Y coordinates to account for imprecision in + * floating point to integer conversion */ + BOOL match = (types[idx] == expected[eidx].type) && + fabs(points[idx].X - expected[eidx].X) <= 2.0 && + fabs(points[idx].Y - expected[eidx].Y) <= 2.0; + + stringify_point_type(expected[eidx].type, ename); + stringify_point_type(types[idx], name); + + if (expected[eidx].todo || numskip) todo_wine + ok(match, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx, + ename, expected[eidx].X, expected[eidx].Y, + name, points[idx].X, points[idx].Y); + else + ok(match, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx, + ename, expected[eidx].X, expected[eidx].Y, + name, points[idx].X, points[idx].Y); + + if (match || expected[eidx].todo != 2) + idx++; + if (match || !numskip--) + numskip = expected[++eidx].wine_only_entries_preceding; + } + +end: + HeapFree(GetProcessHeap(), 0, types); + HeapFree(GetProcessHeap(), 0, points); +} + +static void test_constructor_destructor(void) +{ + GpStatus status; + GpPath* path = NULL; + + status = GdipCreatePath(FillModeAlternate, &path); + expect(Ok, status); + ok(path != NULL, "Expected path to be initialized\n"); + + status = GdipDeletePath(NULL); + expect(InvalidParameter, status); + + status = GdipDeletePath(path); + expect(Ok, status); +} + +static path_test_t line2_path[] = { + {0.0, 50.0, PathPointTypeStart, 0, 0}, /*0*/ + {5.0, 45.0, PathPointTypeLine, 0, 0}, /*1*/ + {0.0, 40.0, PathPointTypeLine, 0, 0}, /*2*/ + {15.0, 35.0, PathPointTypeLine, 0, 0}, /*3*/ + {0.0, 30.0, PathPointTypeLine, 0, 0}, /*4*/ + {25.0, 25.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*5*/ + {0.0, 20.0, PathPointTypeStart, 0, 0}, /*6*/ + {35.0, 15.0, PathPointTypeLine, 0, 0}, /*7*/ + {0.0, 10.0, PathPointTypeLine, 0, 0} /*8*/ + }; + +static void test_line2(void) +{ + GpStatus status; + GpPath* path; + int i; + GpPointF line2_points[9]; + + for(i = 0; i < 9; i ++){ + line2_points[i].X = i * 5.0 * (REAL)(i % 2); + line2_points[i].Y = 50.0 - i * 5.0; + } + + GdipCreatePath(FillModeAlternate, &path); + status = GdipAddPathLine2(path, line2_points, 3); + expect(Ok, status); + status = GdipAddPathLine2(path, &(line2_points[3]), 3); + expect(Ok, status); + status = GdipClosePathFigure(path); + expect(Ok, status); + status = GdipAddPathLine2(path, &(line2_points[6]), 3); + expect(Ok, status); + + ok_path(path, line2_path, sizeof(line2_path)/sizeof(path_test_t), FALSE); +} + +static path_test_t arc_path[] = { + {600.0, 450.0, PathPointTypeStart, 0, 0}, /*0*/ + {600.0, 643.3, PathPointTypeBezier, 0, 0}, /*1*/ + {488.1, 800.0, PathPointTypeBezier, 0, 0}, /*2*/ + {350.0, 800.0, PathPointTypeBezier, 0, 0}, /*3*/ + {600.0, 450.0, PathPointTypeLine, 0, 0}, /*4*/ + {600.0, 643.3, PathPointTypeBezier, 0, 0}, /*5*/ + {488.1, 800.0, PathPointTypeBezier, 0, 0}, /*6*/ + {350.0, 800.0, PathPointTypeBezier, 0, 0}, /*7*/ + {329.8, 800.0, PathPointTypeBezier, 0, 0}, /*8*/ + {309.7, 796.6, PathPointTypeBezier, 0, 0}, /*9*/ + {290.1, 789.8, PathPointTypeBezier, 0, 0}, /*10*/ + {409.9, 110.2, PathPointTypeLine, 0, 0}, /*11*/ + {544.0, 156.5, PathPointTypeBezier, 0, 0}, /*12*/ + {625.8, 346.2, PathPointTypeBezier, 0, 0}, /*13*/ + {592.7, 533.9, PathPointTypeBezier, 0, 0}, /*14*/ + {592.5, 535.3, PathPointTypeBezier, 0, 0}, /*15*/ + {592.2, 536.7, PathPointTypeBezier, 0, 0}, /*16*/ + {592.0, 538.1, PathPointTypeBezier, 0, 0}, /*17*/ + {409.9, 789.8, PathPointTypeLine, 0, 0}, /*18*/ + {544.0, 743.5, PathPointTypeBezier, 0, 0}, /*19*/ + {625.8, 553.8, PathPointTypeBezier, 0, 0}, /*20*/ + {592.7, 366.1, PathPointTypeBezier, 0, 0}, /*21*/ + {592.5, 364.7, PathPointTypeBezier, 0, 0}, /*22*/ + {592.2, 363.3, PathPointTypeBezier, 0, 0}, /*23*/ + {592.0, 361.9, PathPointTypeBezier, 0, 0}, /*24*/ + {540.4, 676.9, PathPointTypeLine, 0, 0}, /*25*/ + {629.9, 529.7, PathPointTypeBezier, 0, 0}, /*26*/ + {617.2, 308.8, PathPointTypeBezier, 0, 0}, /*27*/ + {512.1, 183.5, PathPointTypeBezier, 0, 0}, /*28*/ + {406.9, 58.2, PathPointTypeBezier, 0, 0}, /*29*/ + {249.1, 75.9, PathPointTypeBezier, 0, 0}, /*30*/ + {159.6, 223.1, PathPointTypeBezier, 0, 0}, /*31*/ + {70.1, 370.3, PathPointTypeBezier, 0, 0}, /*32*/ + {82.8, 591.2, PathPointTypeBezier, 0, 0}, /*33*/ + {187.9, 716.5, PathPointTypeBezier, 0, 0}, /*34*/ + {293.1, 841.8, PathPointTypeBezier, 0, 0}, /*35*/ + {450.9, 824.1, PathPointTypeBezier, 0, 0}, /*36*/ + {540.4, 676.9, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 1} /*37*/ + }; + +static void test_arc(void) +{ + GpStatus status; + GpPath* path; + + GdipCreatePath(FillModeAlternate, &path); + /* Exactly 90 degrees */ + status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0); + expect(Ok, status); + /* Over 90 degrees */ + status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0); + expect(Ok, status); + /* Negative start angle */ + status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0); + expect(Ok, status); + /* Negative sweep angle */ + status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 80.0, -100.0); + expect(Ok, status); + /* More than a full revolution */ + status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, -400.0); + expect(Ok, status); + /* 0 sweep angle */ + status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0); + expect(Ok, status); + + ok_path(path, arc_path, sizeof(arc_path)/sizeof(path_test_t), FALSE); +} + +static void test_worldbounds(void) +{ + GpStatus status; + GpPath *path; + GpPen *pen; + GpMatrix *matrix; + GpRectF bounds; + GpPointF line2_points[10]; + int i; + + for(i = 0; i < 10; i ++){ + line2_points[i].X = 200.0 + i * 50.0 * (i % 2); + line2_points[i].Y = 200.0 + i * 50.0 * !(i % 2); + } + GdipCreatePen1((ARGB)0xdeadbeef, 20.0, UnitWorld, &pen); + GdipSetPenEndCap(pen, LineCapSquareAnchor); + GdipCreateMatrix2(1.5, 0.0, 1.0, 1.2, 10.4, 10.2, &matrix); + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0); + GdipAddPathLine2(path, &(line2_points[0]), 10); + status = GdipGetPathWorldBounds(path, &bounds, NULL, NULL); + expect(Ok, status); + GdipDeletePath(path); + + expectf(200.0, bounds.X); + expectf(200.0, bounds.Y); + expectf(450.0, bounds.Width); + expectf(600.0, bounds.Height); + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0); + GdipAddPathLine2(path, &(line2_points[0]), 10); + status = GdipGetPathWorldBounds(path, &bounds, matrix, NULL); + expect(Ok, status); + GdipDeletePath(path); + + expectf(510.4, bounds.X); + expectf(250.2, bounds.Y); + expectf(1275.0, bounds.Width); + expectf(720.0, bounds.Height); + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0); + GdipAddPathLine2(path, &(line2_points[0]), 10); + status = GdipGetPathWorldBounds(path, &bounds, NULL, pen); + expect(Ok, status); + GdipDeletePath(path); + + expectf(100.0, bounds.X); + expectf(100.0, bounds.Y); + expectf(650.0, bounds.Width); + expectf(800.0, bounds.Height); + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathLine2(path, &(line2_points[0]), 2); + status = GdipGetPathWorldBounds(path, &bounds, NULL, pen); + expect(Ok, status); + GdipDeletePath(path); + + expectf(156.0, bounds.X); + expectf(156.0, bounds.Y); + expectf(138.0, bounds.Width); + expectf(88.0, bounds.Height); + + line2_points[2].X = 2 * line2_points[1].X - line2_points[0].X; + line2_points[2].Y = 2 * line2_points[1].Y - line2_points[0].Y; + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathLine2(path, &(line2_points[0]), 3); + status = GdipGetPathWorldBounds(path, &bounds, NULL, pen); + expect(Ok, status); + GdipDeletePath(path); + + expectf(100.0, bounds.X); + expectf(100.0, bounds.Y); + expectf(300.0, bounds.Width); + expectf(200.0, bounds.Height); + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 45.0, 20.0); + status = GdipGetPathWorldBounds(path, &bounds, NULL, pen); + expect(Ok, status); + GdipDeletePath(path); + + expectf(386.7, bounds.X); + expectf(553.4, bounds.Y); + expectf(266.8, bounds.Width); + expectf(289.6, bounds.Height); + + GdipCreatePath(FillModeAlternate, &path); + status = GdipGetPathWorldBounds(path, &bounds, matrix, pen); + expect(Ok, status); + GdipDeletePath(path); + + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf(0.0, bounds.Width); + expectf(0.0, bounds.Height); + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathLine2(path, &(line2_points[0]), 2); + status = GdipGetPathWorldBounds(path, &bounds, matrix, pen); + expect(Ok, status); + GdipDeletePath(path); + + todo_wine{ + expectf(427.9, bounds.X); + expectf(167.7, bounds.Y); + expectf(239.9, bounds.Width); + expectf(164.9, bounds.Height); + } + + GdipDeleteMatrix(matrix); + GdipCreateMatrix2(0.9, -0.5, -0.5, -1.2, 10.4, 10.2, &matrix); + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0); + GdipAddPathLine2(path, &(line2_points[0]), 10); + status = GdipGetPathWorldBounds(path, &bounds, matrix, NULL); + expect(Ok, status); + GdipDeletePath(path); + + expectf(-209.6, bounds.X); + expectf(-1274.8, bounds.Y); + expectf(705.0, bounds.Width); + expectf(945.0, bounds.Height); +} + +static path_test_t pathpath_path[] = { + {600.00, 450.00, PathPointTypeStart, 0, 0}, /*0*/ + {600.00, 643.30, PathPointTypeBezier, 0, 0}, /*1*/ + {488.07, 800.00, PathPointTypeBezier, 0, 0}, /*2*/ + {350.00, 800.00, PathPointTypeBezier, 0, 0}, /*3*/ + {319.61, 797.40, PathPointTypeStart, 0, 0}, /*4*/ + {182.56, 773.90, PathPointTypeBezier, 0, 0}, /*5*/ + {85.07, 599.31, PathPointTypeBezier, 0, 0}, /*6*/ + {101.85, 407.45, PathPointTypeBezier, 0, 0}, /*7*/ + {102.54, 399.66, PathPointTypeBezier, 0, 0}, /*8*/ + {103.40, 391.91, PathPointTypeBezier, 0, 0}, /*9*/ + {104.46, 384.21, PathPointTypeBezier, 0, 0}, /*10*/ + {409.92, 110.20, PathPointTypeLine, 0, 0}, /*11*/ + {543.96, 156.53, PathPointTypeBezier, 0, 0}, /*12*/ + {625.80, 346.22, PathPointTypeBezier, 0, 0}, /*13*/ + {592.71, 533.88, PathPointTypeBezier, 0, 0}, /*14*/ + {592.47, 535.28, PathPointTypeBezier, 0, 0}, /*15*/ + {592.22, 536.67, PathPointTypeBezier, 0, 0}, /*16*/ + {591.96, 538.06, PathPointTypeBezier, 0, 0}, /*17*/ + {319.61, 797.40, PathPointTypeLine, 0, 0}, /*18*/ + {182.56, 773.90, PathPointTypeBezier, 0, 0}, /*19*/ + {85.07, 599.31, PathPointTypeBezier, 0, 0}, /*20*/ + {101.85, 407.45, PathPointTypeBezier, 0, 0}, /*21*/ + {102.54, 399.66, PathPointTypeBezier, 0, 0}, /*22*/ + {103.40, 391.91, PathPointTypeBezier, 0, 0}, /*23*/ + {104.46, 384.21, PathPointTypeBezier, 0, 0} /*24*/ + }; + +static void test_pathpath(void) +{ + GpStatus status; + GpPath* path1, *path2; + + GdipCreatePath(FillModeAlternate, &path2); + GdipAddPathArc(path2, 100.0, 100.0, 500.0, 700.0, 95.0, 100.0); + + GdipCreatePath(FillModeAlternate, &path1); + GdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0); + status = GdipAddPathPath(path1, path2, FALSE); + expect(Ok, status); + GdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0); + status = GdipAddPathPath(path1, path2, TRUE); + expect(Ok, status); + + ok_path(path1, pathpath_path, sizeof(pathpath_path)/sizeof(path_test_t), FALSE); + + GdipDeletePath(path1); + GdipDeletePath(path2); +} + +static path_test_t ellipse_path[] = { + {30.00, 125.25, PathPointTypeStart, 0, 0}, /*0*/ + {30.00, 139.20, PathPointTypeBezier, 0, 0}, /*1*/ + {25.52, 150.50, PathPointTypeBezier, 0, 0}, /*2*/ + {20.00, 150.50, PathPointTypeBezier, 0, 0}, /*3*/ + {14.48, 150.50, PathPointTypeBezier, 0, 0}, /*4*/ + {10.00, 139.20, PathPointTypeBezier, 0, 0}, /*5*/ + {10.00, 125.25, PathPointTypeBezier, 0, 0}, /*6*/ + {10.00, 111.30, PathPointTypeBezier, 0, 0}, /*7*/ + {14.48, 100.00, PathPointTypeBezier, 0, 0}, /*8*/ + {20.00, 100.00, PathPointTypeBezier, 0, 0}, /*9*/ + {25.52, 100.00, PathPointTypeBezier, 0, 0}, /*10*/ + {30.00, 111.30, PathPointTypeBezier, 0, 0}, /*11*/ + {30.00, 125.25, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0}, /*12*/ + {7.00, 11.00, PathPointTypeStart, 0, 0}, /*13*/ + {13.00, 17.00, PathPointTypeLine, 0, 0}, /*14*/ + {5.00, 195.00, PathPointTypeStart, 0, 0}, /*15*/ + {5.00, 192.24, PathPointTypeBezier, 0, 0}, /*16*/ + {6.12, 190.00, PathPointTypeBezier, 0, 0}, /*17*/ + {7.50, 190.00, PathPointTypeBezier, 0, 0}, /*18*/ + {8.88, 190.00, PathPointTypeBezier, 0, 0}, /*19*/ + {10.00, 192.24, PathPointTypeBezier, 0, 0}, /*20*/ + {10.00, 195.00, PathPointTypeBezier, 0, 0}, /*21*/ + {10.00, 197.76, PathPointTypeBezier, 0, 0}, /*22*/ + {8.88, 200.00, PathPointTypeBezier, 0, 0}, /*23*/ + {7.50, 200.00, PathPointTypeBezier, 0, 0}, /*24*/ + {6.12, 200.00, PathPointTypeBezier, 0, 0}, /*25*/ + {5.00, 197.76, PathPointTypeBezier, 0, 0}, /*26*/ + {5.00, 195.00, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0}, /*27*/ + {10.00, 300.50, PathPointTypeStart, 0, 0}, /*28*/ + {10.00, 300.78, PathPointTypeBezier, 0, 0}, /*29*/ + {10.00, 301.00, PathPointTypeBezier, 0, 0}, /*30*/ + {10.00, 301.00, PathPointTypeBezier, 0, 0}, /*31*/ + {10.00, 301.00, PathPointTypeBezier, 0, 0}, /*32*/ + {10.00, 300.78, PathPointTypeBezier, 0, 0}, /*33*/ + {10.00, 300.50, PathPointTypeBezier, 0, 0}, /*34*/ + {10.00, 300.22, PathPointTypeBezier, 0, 0}, /*35*/ + {10.00, 300.00, PathPointTypeBezier, 0, 0}, /*36*/ + {10.00, 300.00, PathPointTypeBezier, 0, 0}, /*37*/ + {10.00, 300.00, PathPointTypeBezier, 0, 0}, /*38*/ + {10.00, 300.22, PathPointTypeBezier, 0, 0}, /*39*/ + {10.00, 300.50, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0} /*40*/ + }; + +static void test_ellipse(void) +{ + GpStatus status; + GpPath *path; + GpPointF points[2]; + + points[0].X = 7.0; + points[0].Y = 11.0; + points[1].X = 13.0; + points[1].Y = 17.0; + + GdipCreatePath(FillModeAlternate, &path); + status = GdipAddPathEllipse(path, 10.0, 100.0, 20.0, 50.5); + expect(Ok, status); + GdipAddPathLine2(path, points, 2); + status = GdipAddPathEllipse(path, 10.0, 200.0, -5.0, -10.0); + expect(Ok, status); + GdipClosePathFigure(path); + status = GdipAddPathEllipse(path, 10.0, 300.0, 0.0, 1.0); + expect(Ok, status); + + ok_path(path, ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t), FALSE); + + GdipDeletePath(path); +} + +static path_test_t linei_path[] = { + {5.00, 5.00, PathPointTypeStart, 0, 0}, /*0*/ + {6.00, 8.00, PathPointTypeLine, 0, 0}, /*1*/ + {409.92, 110.20, PathPointTypeLine, 0, 0}, /*2*/ + {543.96, 156.53, PathPointTypeBezier, 0, 0}, /*3*/ + {625.80, 346.22, PathPointTypeBezier, 0, 0}, /*4*/ + {592.71, 533.88, PathPointTypeBezier, 0, 0}, /*5*/ + {592.47, 535.28, PathPointTypeBezier, 0, 0}, /*6*/ + {592.22, 536.67, PathPointTypeBezier, 0, 0}, /*7*/ + {591.96, 538.06, PathPointTypeBezier, 0, 0}, /*8*/ + {15.00, 15.00, PathPointTypeLine, 0, 0}, /*9*/ + {26.00, 28.00, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*10*/ + {35.00, 35.00, PathPointTypeStart, 0, 0}, /*11*/ + {36.00, 38.00, PathPointTypeLine, 0, 0} /*12*/ + }; + +static void test_linei(void) +{ + GpStatus status; + GpPath *path; + GpPointF points[2]; + + points[0].X = 7.0; + points[0].Y = 11.0; + points[1].X = 13.0; + points[1].Y = 17.0; + + GdipCreatePath(FillModeAlternate, &path); + status = GdipAddPathLineI(path, 5.0, 5.0, 6.0, 8.0); + expect(Ok, status); + GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0); + status = GdipAddPathLineI(path, 15.0, 15.0, 26.0, 28.0); + expect(Ok, status); + GdipClosePathFigure(path); + status = GdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0); + expect(Ok, status); + + ok_path(path, linei_path, sizeof(linei_path)/sizeof(path_test_t), FALSE); + + GdipDeletePath(path); +} + +static path_test_t rect_path[] = { + {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/ + {105.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/ + {105.0, 55.0, PathPointTypeLine, 0, 0}, /*2*/ + {5.0, 55.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*3*/ + + {100.0, 50.0, PathPointTypeStart, 0, 0}, /*4*/ + {220.0, 50.0, PathPointTypeLine, 0, 0}, /*5*/ + {220.0, 80.0, PathPointTypeLine, 0, 0}, /*6*/ + {100.0, 80.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0} /*7*/ + }; + +static void test_rect(void) +{ + GpStatus status; + GpPath *path; + + GdipCreatePath(FillModeAlternate, &path); + status = GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0); + expect(Ok, status); + status = GdipAddPathRectangle(path, 100.0, 50.0, 120.0, 30.0); + expect(Ok, status); + + ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE); + + GdipDeletePath(path); +} + +START_TEST(graphicspath) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_constructor_destructor(); + test_line2(); + test_arc(); + test_worldbounds(); + test_pathpath(); + test_ellipse(); + test_linei(); + test_rect(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/graphicspath.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/image.c…
============================================================================== --- trunk/rostests/winetests/gdiplus/image.c (added) +++ trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,477 @@ +/* + * Unit test suite for images + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#include "gdiplus.h" +#include "wine/test.h" +#include <math.h> +#include "wingdi.h" + +#define expect(expected, got) ok(((UINT)got) == ((UINT)expected), "Expected %.8x, got %.8x\n", (UINT)expected, (UINT)got) + +static void test_Scan0(void) +{ + GpBitmap *bm; + GpStatus stat; + BYTE buff[360]; + + bm = NULL; + stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm); + expect(Ok, stat); + ok(NULL != bm, "Expected bitmap to be initialized\n"); + if (stat == Ok) + GdipDisposeImage((GpImage*)bm); + + bm = (GpBitmap*)0xdeadbeef; + stat = GdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm); + expect(InvalidParameter, stat); + + expect(NULL, bm); + + bm = (GpBitmap*)0xdeadbeef; + stat = GdipCreateBitmapFromScan0(-10, 10, 10, PixelFormat24bppRGB, NULL, &bm); + expect(InvalidParameter, stat); + + expect(NULL, bm); + + bm = (GpBitmap*)0xdeadbeef; + stat = GdipCreateBitmapFromScan0(10, 0, 10, PixelFormat24bppRGB, NULL, &bm); + expect(InvalidParameter, stat); + + expect(NULL, bm); + + bm = NULL; + stat = GdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm); + expect(Ok, stat); + ok(NULL != bm, "Expected bitmap to be initialized\n"); + if (stat == Ok) + GdipDisposeImage((GpImage*)bm); + + bm = (GpBitmap*) 0xdeadbeef; + stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm); + expect(InvalidParameter, stat); + expect(NULL, bm); + + bm = (GpBitmap*)0xdeadbeef; + stat = GdipCreateBitmapFromScan0(10, 10, 0, PixelFormat24bppRGB, buff, &bm); + expect(InvalidParameter, stat); + expect(0xdeadbeef, bm); +} + +static void test_GetImageDimension(void) +{ + GpBitmap *bm; + GpStatus stat; + const REAL WIDTH = 10.0, HEIGHT = 20.0; + REAL w,h; + + bm = (GpBitmap*)0xdeadbeef; + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm); + expect(Ok,stat); + ok((GpBitmap*)0xdeadbeef != bm, "Expected bitmap to not be 0xdeadbeef\n"); + ok(NULL != bm, "Expected bitmap to not be NULL\n"); + + stat = GdipGetImageDimension(NULL,&w,&h); + expect(InvalidParameter, stat); + + stat = GdipGetImageDimension((GpImage*)bm,NULL,&h); + expect(InvalidParameter, stat); + + stat = GdipGetImageDimension((GpImage*)bm,&w,NULL); + expect(InvalidParameter, stat); + + w = -1; + h = -1; + stat = GdipGetImageDimension((GpImage*)bm,&w,&h); + expect(Ok, stat); + ok(fabs(WIDTH - w) < 0.0001, "Width wrong\n"); + ok(fabs(HEIGHT - h) < 0.0001, "Height wrong\n"); + GdipDisposeImage((GpImage*)bm); +} + +static void test_LoadingImages(void) +{ + GpStatus stat; + + stat = GdipCreateBitmapFromFile(0, 0); + expect(InvalidParameter, stat); + + stat = GdipCreateBitmapFromFile(0, (GpBitmap**)0xdeadbeef); + expect(InvalidParameter, stat); + + stat = GdipLoadImageFromFile(0, 0); + expect(InvalidParameter, stat); + + stat = GdipLoadImageFromFile(0, (GpImage**)0xdeadbeef); + expect(InvalidParameter, stat); + + stat = GdipLoadImageFromFileICM(0, 0); + expect(InvalidParameter, stat); + + stat = GdipLoadImageFromFileICM(0, (GpImage**)0xdeadbeef); + expect(InvalidParameter, stat); +} + +static void test_SavingImages(void) +{ + GpStatus stat; + GpBitmap *bm; + UINT n; + UINT s; + const REAL WIDTH = 10.0, HEIGHT = 20.0; + REAL w, h; + ImageCodecInfo *codecs; + static const WCHAR filename[] = { 'a','.','b','m','p',0 }; + + codecs = NULL; + + stat = GdipSaveImageToFile(0, 0, 0, 0); + expect(InvalidParameter, stat); + + bm = NULL; + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm); + expect(Ok, stat); + if (!bm) + return; + + /* invalid params */ + stat = GdipSaveImageToFile((GpImage*)bm, 0, 0, 0); + expect(InvalidParameter, stat); + + stat = GdipSaveImageToFile((GpImage*)bm, filename, 0, 0); + expect(InvalidParameter, stat); + + /* encoder tests should succeed -- already tested */ + stat = GdipGetImageEncodersSize(&n, &s); + if (stat != Ok || n == 0) goto cleanup; + + codecs = GdipAlloc(s); + if (!codecs) goto cleanup; + + stat = GdipGetImageEncoders(n, s, codecs); + if (stat != Ok) goto cleanup; + + stat = GdipSaveImageToFile((GpImage*)bm, filename, &codecs[0].Clsid, 0); + expect(stat, Ok); + + GdipDisposeImage((GpImage*)bm); + bm = 0; + + /* re-load and check image stats */ + stat = GdipLoadImageFromFile(filename, (GpImage**)&bm); + expect(stat, Ok); + if (stat != Ok) goto cleanup; + + stat = GdipGetImageDimension((GpImage*)bm, &w, &h); + if (stat != Ok) goto cleanup; + + ok((fabs(w - WIDTH) < 0.01) && (fabs(h - HEIGHT) < 0.01), + "Saved image dimensions are different!\n"); + + cleanup: + GdipFree(codecs); + if (bm) + GdipDisposeImage((GpImage*)bm); + ok(DeleteFileW(filename), "Delete failed.\n"); +} + +static void test_encoders(void) +{ + GpStatus stat; + UINT n; + UINT s; + ImageCodecInfo *codecs; + int i; + int bmp_found; + + static const WCHAR bmp_format[] = {'B', 'M', 'P', 0}; + + stat = GdipGetImageEncodersSize(&n, &s); + expect(stat, Ok); + + codecs = GdipAlloc(s); + if (!codecs) + return; + + stat = GdipGetImageEncoders(n, s, NULL); + expect(GenericError, stat); + + stat = GdipGetImageEncoders(0, s, codecs); + expect(GenericError, stat); + + stat = GdipGetImageEncoders(n, s-1, codecs); + expect(GenericError, stat); + + stat = GdipGetImageEncoders(n, s+1, codecs); + expect(GenericError, stat); + + stat = GdipGetImageEncoders(n, s, codecs); + expect(stat, Ok); + + bmp_found = FALSE; + for (i = 0; i < n; i++) + { + if (CompareStringW(LOCALE_SYSTEM_DEFAULT, 0, + codecs[i].FormatDescription, -1, + bmp_format, -1) == CSTR_EQUAL) { + bmp_found = TRUE; + break; + } + } + if (!bmp_found) + ok(FALSE, "No BMP codec found.\n"); + + GdipFree(codecs); +} + +static void test_LockBits(void) +{ + GpStatus stat; + GpBitmap *bm; + GpRect rect; + BitmapData bd; + const INT WIDTH = 10, HEIGHT = 20; + + bm = NULL; + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm); + expect(Ok, stat); + + rect.X = 2; + rect.Y = 3; + rect.Width = 4; + rect.Height = 5; + + /* read-only */ + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + + if (stat == Ok) { + stat = GdipBitmapUnlockBits(bm, &bd); + expect(Ok, stat); + } + + /* read-only, with NULL rect -> whole bitmap lock */ + stat = GdipBitmapLockBits(bm, NULL, ImageLockModeRead, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + expect(bd.Width, WIDTH); + expect(bd.Height, HEIGHT); + + if (stat == Ok) { + stat = GdipBitmapUnlockBits(bm, &bd); + expect(Ok, stat); + } + + /* read-only, consecutive */ + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + + if (stat == Ok) { + stat = GdipBitmapUnlockBits(bm, &bd); + expect(Ok, stat); + } + + stat = GdipDisposeImage((GpImage*)bm); + expect(Ok, stat); + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm); + expect(Ok, stat); + + /* read x2 */ + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd); + expect(WrongState, stat); + + stat = GdipBitmapUnlockBits(bm, &bd); + expect(Ok, stat); + + stat = GdipDisposeImage((GpImage*)bm); + expect(Ok, stat); + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm); + expect(Ok, stat); + + /* write, no modification */ + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + + if (stat == Ok) { + stat = GdipBitmapUnlockBits(bm, &bd); + expect(Ok, stat); + } + + /* write, consecutive */ + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + + if (stat == Ok) { + stat = GdipBitmapUnlockBits(bm, &bd); + expect(Ok, stat); + } + + stat = GdipDisposeImage((GpImage*)bm); + expect(Ok, stat); + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm); + expect(Ok, stat); + + /* write, modify */ + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + + if (stat == Ok) { + if (bd.Scan0) + ((char*)bd.Scan0)[2] = 0xff; + + stat = GdipBitmapUnlockBits(bm, &bd); + expect(Ok, stat); + } + + stat = GdipDisposeImage((GpImage*)bm); + expect(Ok, stat); + + /* dispose locked */ + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm); + expect(Ok, stat); + stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd); + expect(Ok, stat); + stat = GdipDisposeImage((GpImage*)bm); + expect(Ok, stat); +} + +static void test_GdipCreateBitmapFromHBITMAP(void) +{ + GpBitmap* gpbm = NULL; + HBITMAP hbm = NULL; + HPALETTE hpal = NULL; + GpStatus stat; + BYTE buff[1000]; + LOGPALETTE* LogPal = NULL; + REAL width, height; + const REAL WIDTH1 = 5; + const REAL HEIGHT1 = 15; + const REAL WIDTH2 = 10; + const REAL HEIGHT2 = 20; + HDC hdc; + BITMAPINFO bmi; + + stat = GdipCreateBitmapFromHBITMAP(NULL, NULL, NULL); + expect(InvalidParameter, stat); + + hbm = CreateBitmap(WIDTH1, HEIGHT1, 1, 1, NULL); + stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, NULL); + expect(InvalidParameter, stat); + + stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm); + expect(Ok, stat); + expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height)); + ok(fabs(WIDTH1 - width) < .0001, "width wrong\n"); + ok(fabs(HEIGHT1 - height) < .0001, "height wrong\n"); + if (stat == Ok) + GdipDisposeImage((GpImage*)gpbm); + GlobalFree(hbm); + + hbm = CreateBitmap(WIDTH2, HEIGHT2, 1, 1, &buff); + stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm); + expect(Ok, stat); + expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height)); + ok(fabs(WIDTH2 - width) < .0001, "width wrong\n"); + ok(fabs(HEIGHT2 - height) < .0001, "height wrong\n"); + if (stat == Ok) + GdipDisposeImage((GpImage*)gpbm); + GlobalFree(hbm); + + hdc = CreateCompatibleDC(0); + ok(hdc != NULL, "CreateCompatibleDC failed\n"); + bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); + bmi.bmiHeader.biHeight = HEIGHT1; + bmi.bmiHeader.biWidth = WIDTH1; + bmi.bmiHeader.biBitCount = 24; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biCompression = BI_RGB; + + hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, NULL, NULL, 0); + ok(hbm != NULL, "CreateDIBSection failed\n"); + + stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm); + expect(Ok, stat); + expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height)); + ok(fabs(WIDTH1 - width) < .0001, "width wrong\n"); + ok(fabs(HEIGHT1 - height) < .0001, "height wrong\n"); + if (stat == Ok) + GdipDisposeImage((GpImage*)gpbm); + + LogPal = GdipAlloc(sizeof(LOGPALETTE)); + ok(LogPal != NULL, "unable to allocate LOGPALETTE\n"); + LogPal->palVersion = 0x300; + hpal = CreatePalette((const LOGPALETTE*) LogPal); + ok(hpal != NULL, "CreatePalette failed\n"); + GdipFree(LogPal); + + stat = GdipCreateBitmapFromHBITMAP(hbm, hpal, &gpbm); + todo_wine + { + expect(Ok, stat); + } + if (stat == Ok) + GdipDisposeImage((GpImage*)gpbm); + + GlobalFree(hpal); + GlobalFree(hbm); +} + +static void test_GdipGetImageFlags(void) +{ + GpImage *img; + GpStatus stat; + UINT flags; + + img = (GpImage*)0xdeadbeef; + + stat = GdipGetImageFlags(NULL, NULL); + expect(InvalidParameter, stat); + + stat = GdipGetImageFlags(NULL, &flags); + expect(InvalidParameter, stat); + + stat = GdipGetImageFlags(img, NULL); + expect(InvalidParameter, stat); +} + +START_TEST(image) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_Scan0(); + test_GetImageDimension(); + test_LoadingImages(); + test_SavingImages(); + test_encoders(); + test_LockBits(); + test_GdipCreateBitmapFromHBITMAP(); + test_GdipGetImageFlags(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/image.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/matrix.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/matrix.…
============================================================================== --- trunk/rostests/winetests/gdiplus/matrix.c (added) +++ trunk/rostests/winetests/gdiplus/matrix.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,108 @@ +/* + * Unit test suite for matrices + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <math.h> + +#include "windows.h" +#include "gdiplus.h" +#include "wine/test.h" + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) + +static void test_constructor_destructor(void) +{ + GpStatus status; + GpMatrix *matrix = NULL; + + status = GdipCreateMatrix2(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &matrix); + expect(Ok, status); + ok(matrix != NULL, "Expected matrix to be initialized\n"); + + status = GdipDeleteMatrix(NULL); + expect(InvalidParameter, status); + + status = GdipDeleteMatrix(matrix); + expect(Ok, status); +} + +typedef struct{ + REAL X; + REAL Y; +} real_point; + +static real_point transform_points[] = { + {1000.00, 2600.00}, /*0*/ + {855.00, 2390.00}, /*1*/ + {700.00, 2200.00}, /*2*/ + {565.00, 1970.00}, /*3*/ + {400.00, 1800.00}, /*4*/ + {275.00, 1550.00}, /*5*/ + {100.00, 1400.00}, /*6*/ + {-15.00, 1130.00}, /*7*/ + {-200.00, 1000.00}, /*8*/ + {-305.00, 710.00} /*9*/ + }; + +static void test_transform(void) +{ + GpStatus status; + GpMatrix *matrix = NULL; + GpPointF pts[10]; + INT i; + BOOL match; + + for(i = 0; i < 10; i ++){ + pts[i].X = i * 5.0 * (REAL)(i % 2); + pts[i].Y = 50.0 - i * 5.0; + } + + GdipCreateMatrix2(1.0, -2.0, 30.0, 40.0, -500.0, 600.0, &matrix); + + status = GdipTransformMatrixPoints(matrix, pts, 10); + expect(Ok, status); + + for(i = 0; i < 10; i ++){ + match = fabs(transform_points[i].X - pts[i].X) < 2.0 + && fabs(transform_points[i].Y - pts[i].Y) < 2.0; + + ok(match, "Expected #%d to be (%.2f, %.2f) but got (%.2f, %.2f)\n", i, + transform_points[i].X, transform_points[i].Y, pts[i].X, pts[i].Y); + } + + GdipDeleteMatrix(matrix); +} + +START_TEST(matrix) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_constructor_destructor(); + test_transform(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/matrix.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/pen.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/pen.c?r…
============================================================================== --- trunk/rostests/winetests/gdiplus/pen.c (added) +++ trunk/rostests/winetests/gdiplus/pen.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,249 @@ +/* + * Unit test suite for pens (and init) + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <math.h> + +#include "windows.h" +#include "gdiplus.h" +#include "wine/test.h" + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) +#define expectf(expected, got) ok(fabs(got - expected) < 0.1, "Expected %.2f, got %.2f\n", expected, got) + +static void test_startup(void) +{ + GpPen *pen = NULL; + Status status; + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + expect(Ok, status); + GdiplusShutdown(gdiplusToken); + + gdiplusStartupInput.GdiplusVersion = 2; + + status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + expect(UnsupportedGdiplusVersion, status); + GdiplusShutdown(gdiplusToken); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + + todo_wine + expect(GdiplusNotInitialized, status); + + GdipDeletePen(pen); +} + +static void test_constructor_destructor(void) +{ + GpStatus status; + GpPen *pen = NULL; + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, NULL); + expect(InvalidParameter, status); + ok(pen == NULL, "Expected pen to be NULL\n"); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + status = GdipDeletePen(NULL); + expect(InvalidParameter, status); + + status = GdipDeletePen(pen); + expect(Ok, status); +} + +static void test_constructor_destructor2(void) +{ + GpStatus status; + GpPen *pen = NULL; + GpBrush *brush = NULL; + GpPointF points[2]; + + status = GdipCreatePen2(NULL, 10.0f, UnitPixel, &pen); + expect(InvalidParameter, status); + ok(pen == NULL, "Expected pen to be NULL\n"); + + points[0].X = 7.0; + points[0].Y = 11.0; + points[1].X = 13.0; + points[1].Y = 17.0; + + status = GdipCreateLineBrush(&points[0], &points[1], (ARGB)0xffff00ff, + (ARGB)0xff0000ff, WrapModeTile, (GpLineGradient **)&brush); + expect(Ok, status); + ok(brush != NULL, "Expected brush to be initialized\n"); + + status = GdipCreatePen2(brush, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized\n"); + + status = GdipDeletePen(pen); + expect(Ok, status); + + status = GdipDeleteBrush(brush); + expect(Ok, status); +} + +static void test_brushfill(void) +{ + GpStatus status; + GpPen *pen; + GpBrush *brush, *brush2; + GpBrushType type; + ARGB color = 0; + + /* default solid */ + GdipCreatePen1(0xdeadbeef, 4.5, UnitWorld, &pen); + status = GdipGetPenBrushFill(pen, &brush); + expect(Ok, status); + GdipGetBrushType(brush, &type); + expect(BrushTypeSolidColor, type); + GdipGetPenColor(pen, &color); + expect(0xdeadbeef, color); + GdipDeleteBrush(brush); + + /* color controlled by brush */ + GdipCreateSolidFill(0xabaddeed, (GpSolidFill**)&brush); + status = GdipSetPenBrushFill(pen, brush); + expect(Ok, status); + GdipGetPenColor(pen, &color); + expect(0xabaddeed, color); + GdipDeleteBrush(brush); + color = 0; + + /* get returns a clone, not a reference */ + GdipGetPenBrushFill(pen, &brush); + GdipSetSolidFillColor((GpSolidFill*)brush, 0xbeadfeed); + GdipGetPenBrushFill(pen, &brush2); + ok(brush != brush2, "Expected to get a clone, not a copy of the reference\n"); + GdipGetSolidFillColor((GpSolidFill*)brush2, &color); + expect(0xabaddeed, color); + GdipDeleteBrush(brush); + GdipDeleteBrush(brush2); + + /* brush cannot be NULL */ + status = GdipSetPenBrushFill(pen, NULL); + expect(InvalidParameter, status); + + GdipDeletePen(pen); +} + +static void test_dasharray(void) +{ + GpPen *pen; + GpDashStyle style; + GpStatus status; + REAL dashes[12]; + + GdipCreatePen1(0xdeadbeef, 10.0, UnitWorld, &pen); + dashes[0] = 10.0; + dashes[1] = 11.0; + dashes[2] = 12.0; + dashes[3] = 13.0; + dashes[4] = 14.0; + dashes[5] = -100.0; + dashes[6] = -100.0; + dashes[7] = dashes[8] = dashes[9] = dashes[10] = dashes[11] = 0.0; + + /* setting the array sets the type to custom */ + GdipGetPenDashStyle(pen, &style); + expect(DashStyleSolid, style); + status = GdipSetPenDashArray(pen, dashes, 2); + expect(Ok, status); + GdipGetPenDashStyle(pen, &style); + expect(DashStyleCustom, style); + + /* Getting the array on a non-custom pen returns invalid parameter (unless + * you are getting 0 elements).*/ + GdipSetPenDashStyle(pen, DashStyleSolid); + status = GdipGetPenDashArray(pen, &dashes[5], 2); + expect(InvalidParameter, status); + status = GdipGetPenDashArray(pen, &dashes[5], 0); + expect(Ok, status); + + /* What does setting DashStyleCustom do to the array length? */ + GdipSetPenDashArray(pen, dashes, 2); + GdipSetPenDashStyle(pen, DashStyleCustom); + status = GdipGetPenDashArray(pen, &dashes[5], 2); + expect(Ok, status); + expectf(10.0, dashes[5]); + expectf(11.0, dashes[6]); + + /* Set the array, then get with different sized buffers. */ + status = GdipSetPenDashArray(pen, dashes, 5); + expect(Ok, status); + dashes[5] = -100.0; + dashes[6] = -100.0; + status = GdipGetPenDashArray(pen, &dashes[5], 1); + expect(Ok, status); /* not InsufficientBuffer! */ + expectf(10.0, dashes[5]); + expectf(-100.0, dashes[6]); + dashes[5] = -100.0; + status = GdipGetPenDashArray(pen, &dashes[5], 6); + expect(InvalidParameter, status); /* not Ok! */ + expectf(-100.0, dashes[5]); + expectf(-100.0, dashes[6]); + + /* Some invalid array values. */ + status = GdipSetPenDashArray(pen, &dashes[7], 5); + expect(InvalidParameter, status); + dashes[9] = -1.0; + status = GdipSetPenDashArray(pen, &dashes[7], 5); + expect(InvalidParameter, status); + + /* Try to set with count = 0. */ + GdipSetPenDashStyle(pen, DashStyleDot); + status = GdipSetPenDashArray(pen, dashes, 0); + expect(OutOfMemory, status); + GdipGetPenDashStyle(pen, &style); + expect(DashStyleDot, style); + + GdipDeletePen(pen); +} + +START_TEST(pen) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + test_startup(); + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_constructor_destructor(); + test_constructor_destructor2(); + test_brushfill(); + test_dasharray(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/pen.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/stringformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/stringf…
============================================================================== --- trunk/rostests/winetests/gdiplus/stringformat.c (added) +++ trunk/rostests/winetests/gdiplus/stringformat.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,67 @@ +/* + * Unit test suite for string format + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#include "gdiplus.h" +#include "wine/test.h" + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) + +static void test_constructor(void) +{ + GpStringFormat *format; + GpStatus stat; + INT n; + StringAlignment align, valign; + StringTrimming trimming; + + stat = GdipCreateStringFormat(0, 0, &format); + expect(Ok, stat); + + GdipGetStringFormatAlign(format, &align); + GdipGetStringFormatLineAlign(format, &valign); + GdipGetStringFormatHotkeyPrefix(format, &n); + GdipGetStringFormatTrimming(format, &trimming); + + expect(HotkeyPrefixNone, n); + expect(StringAlignmentNear, align); + expect(StringAlignmentNear, align); + expect(StringTrimmingCharacter, trimming); + + stat = GdipDeleteStringFormat(format); + expect(Ok, stat); +} + +START_TEST(stringformat) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_constructor(); + + GdiplusShutdown(gdiplusToken); +} Propchange: trunk/rostests/winetests/gdiplus/stringformat.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/winetests/gdiplus/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/testlis…
============================================================================== --- trunk/rostests/winetests/gdiplus/testlist.c (added) +++ trunk/rostests/winetests/gdiplus/testlist.c [iso-8859-1] Sun Jun 8 04:47:47 2008 @@ -1,0 +1,29 @@ +/* Automatically generated file; DO NOT EDIT!! */ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +#define STANDALONE +#include "wine/test.h" + +extern void func_brush(void); +extern void func_graphics(void); +extern void func_graphicspath(void); +extern void func_image(void); +extern void func_matrix(void); +extern void func_pen(void); +extern void func_stringformat(void); +extern void func_font(void); + +const struct test winetest_testlist[] = +{ + { "brush", func_brush }, + { "graphics", func_graphics }, + { "graphicspath", func_graphicspath }, + { "font", func_font }, + { "image", func_image }, + { "matrix", func_matrix }, + { "stringformat", func_stringformat }, + { "pen", func_pen }, + { 0, 0 } +}; Propchange: trunk/rostests/winetests/gdiplus/testlist.c ------------------------------------------------------------------------------ svn:eol-style = native
16 years, 6 months
1
0
0
0
[greatlrd] 33896: add dummy test for dciman32 for now, real test will come later
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Jun 8 03:29:04 2008 New Revision: 33896 URL:
http://svn.reactos.org/svn/reactos?rev=33896&view=rev
Log: add dummy test for dciman32 for now, real test will come later Added: trunk/rostests/apitests/dciman32api/ trunk/rostests/apitests/dciman32api/dciman32api.c (with props) trunk/rostests/apitests/dciman32api/dciman32api.h (with props) trunk/rostests/apitests/dciman32api/dciman32api.rbuild (with props) trunk/rostests/apitests/dciman32api/testlist.c (with props) trunk/rostests/apitests/dciman32api/tests/ trunk/rostests/apitests/dciman32api/tests/DCICreatePrimary.c (with props) Modified: trunk/rostests/apitests/directory.rbuild Added: trunk/rostests/apitests/dciman32api/dciman32api.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/dciman32api/dcim…
============================================================================== --- trunk/rostests/apitests/dciman32api/dciman32api.c (added) +++ trunk/rostests/apitests/dciman32api/dciman32api.c [iso-8859-1] Sun Jun 8 03:29:04 2008 @@ -1,0 +1,19 @@ +#include "dciman32api.h" + +HINSTANCE g_hInstance; + +BOOL +IsFunctionPresent(LPWSTR lpszFunction) +{ + return TRUE; +} + +int APIENTRY +WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + g_hInstance = hInstance; + return TestMain(L"dciman32api", L"dciman32.dll"); +} Propchange: trunk/rostests/apitests/dciman32api/dciman32api.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/dciman32api/dciman32api.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/dciman32api/dcim…
============================================================================== --- trunk/rostests/apitests/dciman32api/dciman32api.h (added) +++ trunk/rostests/apitests/dciman32api/dciman32api.h [iso-8859-1] Sun Jun 8 03:29:04 2008 @@ -1,0 +1,22 @@ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif + +#define WIN32_NO_STATUS +#include <windows.h> +#include <windows.h> +#include <ndk/ntndk.h> +#include <wingdi.h> +#include <winddi.h> +#include <d3dnthal.h> +#include <prntfont.h> + +/* Public Win32K Headers */ +#include <win32k/ntgdityp.h> +#include <ntgdi.h> +#include <win32k/ntgdihdl.h> + +#include "../apitest.h" + + + Propchange: trunk/rostests/apitests/dciman32api/dciman32api.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/dciman32api/dciman32api.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/dciman32api/dcim…
============================================================================== --- trunk/rostests/apitests/dciman32api/dciman32api.rbuild (added) +++ trunk/rostests/apitests/dciman32api/dciman32api.rbuild [iso-8859-1] Sun Jun 8 03:29:04 2008 @@ -1,0 +1,12 @@ +<module name="dciman32api" type="win32cui"> + <include base="dciman32api">.</include> + <define name="__USE_W32API" /> + <define name="_WIN32_WINNT">0x0501</define> + <library>apitest</library> + <library>kernel32</library> + <library>user32</library> + <library>gdi32</library> + <library>shell32</library> + <file>dciman32api.c</file> + <file>testlist.c</file> +</module> Propchange: trunk/rostests/apitests/dciman32api/dciman32api.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/dciman32api/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/dciman32api/test…
============================================================================== --- trunk/rostests/apitests/dciman32api/testlist.c (added) +++ trunk/rostests/apitests/dciman32api/testlist.c [iso-8859-1] Sun Jun 8 03:29:04 2008 @@ -1,0 +1,32 @@ +#ifndef _DCIMAN32TESTLIST_H +#define _DCIMAN32TESTLIST_H + +#include "dciman32api.h" + +/* include the tests */ +#include "tests/DCICreatePrimary.c" + + + + + + + + + + +/* The List of tests */ +TESTENTRY TestList[] = +{ + { L"DCICreatePrimary", Test_DCICreatePrimary } +}; + +/* The function that gives us the number of tests */ +INT NumTests(void) +{ + return sizeof(TestList) / sizeof(TESTENTRY); +} + +#endif + +/* EOF */ Propchange: trunk/rostests/apitests/dciman32api/testlist.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/dciman32api/tests/DCICreatePrimary.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/dciman32api/test…
============================================================================== --- trunk/rostests/apitests/dciman32api/tests/DCICreatePrimary.c (added) +++ trunk/rostests/apitests/dciman32api/tests/DCICreatePrimary.c [iso-8859-1] Sun Jun 8 03:29:04 2008 @@ -1,0 +1,8 @@ + +INT +Test_DCICreatePrimary(PTESTINFO pti) +{ + + return APISTATUS_NORMAL; +} + Propchange: trunk/rostests/apitests/dciman32api/tests/DCICreatePrimary.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/directory.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/directory.rbuild…
============================================================================== --- trunk/rostests/apitests/directory.rbuild [iso-8859-1] (original) +++ trunk/rostests/apitests/directory.rbuild [iso-8859-1] Sun Jun 8 03:29:04 2008 @@ -7,6 +7,10 @@ <define name="_WIN32_WINNT">0x0501</define> <file>apitest.c</file> </module> + + <directory name="dciman32api"> + <xi:include href="dciman32api/dciman32api.rbuild" /> + </directory> <directory name="gdi32api"> <xi:include href="gdi32api/gdi32api.rbuild" />
16 years, 6 months
1
0
0
0
[fireball] 33895: - Magnus: Reformat clip.c source code to better match overall coding style. No code logic change.
by fireball@svn.reactos.org
Author: fireball Date: Sun Jun 8 02:31:10 2008 New Revision: 33895 URL:
http://svn.reactos.org/svn/reactos?rev=33895&view=rev
Log: - Magnus: Reformat clip.c source code to better match overall coding style. No code logic change. Modified: trunk/reactos/subsystems/win32/win32k/eng/clip.c Modified: trunk/reactos/subsystems/win32/win32k/eng/clip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/clip.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/clip.c [iso-8859-1] Sun Jun 8 02:31:10 2008 @@ -33,231 +33,239 @@ #include <debug.h> static __inline int -CompareRightDown(const PRECT r1, const PRECT r2) -{ - int Cmp; - - if (r1->top < r2->top) - { - Cmp = -1; - } - else if (r2->top < r1->top) - { - Cmp = +1; - } - else - { - ASSERT(r1->bottom == r2->bottom); - if (r1->left < r2->left) - { - Cmp = -1; - } - else if (r2->left < r1->left) - { - Cmp = +1; - } - else - { - ASSERT(r1->right == r2->right); - Cmp = 0; - } - } - - return Cmp; +CompareRightDown( + const PRECT r1, + const PRECT r2) +{ + int Cmp; + + if (r1->top < r2->top) + { + Cmp = -1; + } + else if (r2->top < r1->top) + { + Cmp = +1; + } + else + { + ASSERT(r1->bottom == r2->bottom); + if (r1->left < r2->left) + { + Cmp = -1; + } + else if (r2->left < r1->left) + { + Cmp = +1; + } + else + { + ASSERT(r1->right == r2->right); + Cmp = 0; + } + } + + return Cmp; } static __inline int -CompareRightUp(const PRECT r1, const PRECT r2) -{ - int Cmp; - - if (r1->bottom < r2->bottom) - { - Cmp = +1; - } - else if (r2->bottom < r1->bottom) - { - Cmp = -1; - } - else - { - ASSERT(r1->top == r2->top); - if (r1->left < r2->left) - { - Cmp = -1; - } - else if (r2->left < r1->left) - { - Cmp = +1; - } - else - { - ASSERT(r1->right == r2->right); - Cmp = 0; - } - } - - return Cmp; +CompareRightUp( + const PRECT r1, + const PRECT r2) +{ + int Cmp; + + if (r1->bottom < r2->bottom) + { + Cmp = +1; + } + else if (r2->bottom < r1->bottom) + { + Cmp = -1; + } + else + { + ASSERT(r1->top == r2->top); + if (r1->left < r2->left) + { + Cmp = -1; + } + else if (r2->left < r1->left) + { + Cmp = +1; + } + else + { + ASSERT(r1->right == r2->right); + Cmp = 0; + } + } + + return Cmp; } static __inline int -CompareLeftDown(const PRECT r1, const PRECT r2) -{ - int Cmp; - - if (r1->top < r2->top) - { - Cmp = -1; - } - else if (r2->top < r1->top) - { - Cmp = +1; - } - else - { - ASSERT(r1->bottom == r2->bottom); - if (r1->right < r2->right) - { - Cmp = +1; - } - else if (r2->right < r1->right) - { - Cmp = -1; - } - else - { - ASSERT(r1->left == r2->left); - Cmp = 0; - } - } - - return Cmp; +CompareLeftDown( + const PRECT r1, + const PRECT r2) +{ + int Cmp; + + if (r1->top < r2->top) + { + Cmp = -1; + } + else if (r2->top < r1->top) + { + Cmp = +1; + } + else + { + ASSERT(r1->bottom == r2->bottom); + if (r1->right < r2->right) + { + Cmp = +1; + } + else if (r2->right < r1->right) + { + Cmp = -1; + } + else + { + ASSERT(r1->left == r2->left); + Cmp = 0; + } + } + + return Cmp; } static __inline int -CompareLeftUp(const PRECT r1, const PRECT r2) -{ - int Cmp; - - if (r1->bottom < r2->bottom) - { - Cmp = +1; - } - else if (r2->bottom < r1->bottom) - { - Cmp = -1; - } - else - { - ASSERT(r1->top == r2->top); - if (r1->right < r2->right) - { - Cmp = +1; - } - else if (r2->right < r1->right) - { - Cmp = -1; - } - else - { - ASSERT(r1->left == r2->left); - Cmp = 0; - } - } - - return Cmp; +CompareLeftUp( + const PRECT r1, + const PRECT r2) +{ + int Cmp; + + if (r1->bottom < r2->bottom) + { + Cmp = +1; + } + else if (r2->bottom < r1->bottom) + { + Cmp = -1; + } + else + { + ASSERT(r1->top == r2->top); + if (r1->right < r2->right) + { + Cmp = +1; + } + else if (r2->right < r1->right) + { + Cmp = -1; + } + else + { + ASSERT(r1->left == r2->left); + Cmp = 0; + } + } + return Cmp; } static __inline int -CompareSpans(const PSPAN Span1, const PSPAN Span2) -{ - int Cmp; - - if (Span1->Y < Span2->Y) - { - Cmp = -1; - } - else if (Span2->Y < Span1->Y) - { - Cmp = +1; - } - else - { - if (Span1->X < Span2->X) - { - Cmp = -1; - } - else if (Span2->X < Span1->X) - { - Cmp = +1; - } - else - { - Cmp = 0; - } - } - - return Cmp; +CompareSpans( + const PSPAN Span1, + const PSPAN Span2) +{ + int Cmp; + + if (Span1->Y < Span2->Y) + { + Cmp = -1; + } + else if (Span2->Y < Span1->Y) + { + Cmp = +1; + } + else + { + if (Span1->X < Span2->X) + { + Cmp = -1; + } + else if (Span2->X < Span1->X) + { + Cmp = +1; + } + else + { + Cmp = 0; + } + } + + return Cmp; } VOID FASTCALL IntEngDeleteClipRegion(CLIPOBJ *ClipObj) { - EngFreeMem(ObjToGDI(ClipObj, CLIP)); + EngFreeMem(ObjToGDI(ClipObj, CLIP)); } CLIPOBJ* FASTCALL IntEngCreateClipRegion(ULONG count, PRECTL pRect, PRECTL rcBounds) { - CLIPGDI *Clip; - - if(count > 1) - { - RECTL *dest; - - Clip = EngAllocMem(0, sizeof(CLIPGDI) + ((count - 1) * sizeof(RECTL)), TAG_CLIPOBJ); - - if(Clip != NULL) - { - Clip->EnumRects.c = count; - Clip->EnumOrder = CD_ANY; - for(dest = Clip->EnumRects.arcl; - count > 0; - count--, dest++, pRect++) - { - *dest = *pRect; - } - - Clip->ClipObj.iDComplexity = DC_COMPLEX; - Clip->ClipObj.iFComplexity = ((Clip->EnumRects.c <= 4) ? FC_RECT4 : FC_COMPLEX); - Clip->ClipObj.iMode = TC_RECTANGLES; - Clip->ClipObj.rclBounds = *rcBounds; - - return GDIToObj(Clip, CLIP); - } - } - else - { - Clip = EngAllocMem(0, sizeof(CLIPGDI), TAG_CLIPOBJ); - - if(Clip != NULL) - { - Clip->EnumRects.c = 1; - Clip->EnumOrder = CD_ANY; - Clip->EnumRects.arcl[0] = *rcBounds; - - Clip->ClipObj.iDComplexity = (((rcBounds->top == rcBounds->bottom) && - (rcBounds->left == rcBounds->right)) - ? DC_TRIVIAL : DC_RECT); - Clip->ClipObj.iFComplexity = FC_RECT; - Clip->ClipObj.iMode = TC_RECTANGLES; - Clip->ClipObj.rclBounds = *rcBounds; - - return GDIToObj(Clip, CLIP); - } - } - - return NULL; + CLIPGDI *Clip; + + if(count > 1) + { + RECTL *dest; + + Clip = EngAllocMem(0, sizeof(CLIPGDI) + ((count - 1) * sizeof(RECTL)), TAG_CLIPOBJ); + + if(Clip != NULL) + { + Clip->EnumRects.c = count; + Clip->EnumOrder = CD_ANY; + for(dest = Clip->EnumRects.arcl;count > 0; count--, dest++, pRect++) + { + *dest = *pRect; + } + + Clip->ClipObj.iDComplexity = DC_COMPLEX; + Clip->ClipObj.iFComplexity = ((Clip->EnumRects.c <= 4) ? FC_RECT4 : FC_COMPLEX); + Clip->ClipObj.iMode = TC_RECTANGLES; + Clip->ClipObj.rclBounds = *rcBounds; + + return GDIToObj(Clip, CLIP); + } + } + else + { + Clip = EngAllocMem(0, sizeof(CLIPGDI), TAG_CLIPOBJ); + + if(Clip != NULL) + { + Clip->EnumRects.c = 1; + Clip->EnumOrder = CD_ANY; + Clip->EnumRects.arcl[0] = *rcBounds; + + Clip->ClipObj.iDComplexity = (((rcBounds->top == rcBounds->bottom) && + (rcBounds->left == rcBounds->right)) + ? DC_TRIVIAL : DC_RECT); + + Clip->ClipObj.iFComplexity = FC_RECT; + Clip->ClipObj.iMode = TC_RECTANGLES; + Clip->ClipObj.rclBounds = *rcBounds; + + return GDIToObj(Clip, CLIP); + } + } + + return NULL; } /* @@ -266,13 +274,13 @@ CLIPOBJ * STDCALL EngCreateClip(VOID) { - CLIPGDI *Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof(CLIPGDI), TAG_CLIPOBJ); - if(Clip != NULL) - { - return GDIToObj(Clip, CLIP); - } - - return NULL; + CLIPGDI *Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof(CLIPGDI), TAG_CLIPOBJ); + if(Clip != NULL) + { + return GDIToObj(Clip, CLIP); + } + + return NULL; } /* @@ -281,196 +289,202 @@ VOID STDCALL EngDeleteClip(CLIPOBJ *ClipRegion) { - EngFreeMem(ObjToGDI(ClipRegion, CLIP)); + EngFreeMem(ObjToGDI(ClipRegion, CLIP)); } /* * @implemented */ ULONG STDCALL -CLIPOBJ_cEnumStart(IN CLIPOBJ* ClipObj, - IN BOOL ShouldDoAll, - IN ULONG ClipType, - IN ULONG BuildOrder, - IN ULONG MaxRects) -{ - CLIPGDI *ClipGDI = ObjToGDI(ClipObj, CLIP); - SORTCOMP CompareFunc; - - ClipGDI->EnumPos = 0; - ClipGDI->EnumMax = (MaxRects > 0) ? MaxRects : ClipGDI->EnumRects.c; - - if (CD_ANY != BuildOrder && ClipGDI->EnumOrder != BuildOrder) - { - switch (BuildOrder) - { - case CD_RIGHTDOWN: - CompareFunc = (SORTCOMP) CompareRightDown; - break; - case CD_RIGHTUP: - CompareFunc = (SORTCOMP) CompareRightUp; - break; - case CD_LEFTDOWN: - CompareFunc = (SORTCOMP) CompareLeftDown; - break; - case CD_LEFTUP: - CompareFunc = (SORTCOMP) CompareLeftUp; - break; - default: - DPRINT1("Invalid BuildOrder %d\n", BuildOrder); - BuildOrder = ClipGDI->EnumOrder; - CompareFunc = NULL; - break; - } - - if (NULL != CompareFunc) - { - EngSort((PBYTE) ClipGDI->EnumRects.arcl, sizeof(RECTL), ClipGDI->EnumRects.c, - CompareFunc); - } - - ClipGDI->EnumOrder = BuildOrder; - } - - /* Return the number of rectangles enumerated */ - if ((MaxRects > 0) && (ClipGDI->EnumRects.c > MaxRects)) - { - return 0xFFFFFFFF; - } - - return ClipGDI->EnumRects.c; +CLIPOBJ_cEnumStart( + IN CLIPOBJ* ClipObj, + IN BOOL ShouldDoAll, + IN ULONG ClipType, + IN ULONG BuildOrder, + IN ULONG MaxRects) +{ + CLIPGDI *ClipGDI = ObjToGDI(ClipObj, CLIP); + SORTCOMP CompareFunc; + + ClipGDI->EnumPos = 0; + ClipGDI->EnumMax = (MaxRects > 0) ? MaxRects : ClipGDI->EnumRects.c; + + if (CD_ANY != BuildOrder && ClipGDI->EnumOrder != BuildOrder) + { + switch (BuildOrder) + { + case CD_RIGHTDOWN: + CompareFunc = (SORTCOMP) CompareRightDown; + break; + + case CD_RIGHTUP: + CompareFunc = (SORTCOMP) CompareRightUp; + break; + + case CD_LEFTDOWN: + CompareFunc = (SORTCOMP) CompareLeftDown; + break; + + case CD_LEFTUP: + CompareFunc = (SORTCOMP) CompareLeftUp; + break; + + default: + DPRINT1("Invalid BuildOrder %d\n", BuildOrder); + BuildOrder = ClipGDI->EnumOrder; + CompareFunc = NULL; + break; + } + + if (NULL != CompareFunc) + { + EngSort((PBYTE) ClipGDI->EnumRects.arcl, sizeof(RECTL), ClipGDI->EnumRects.c, CompareFunc); + } + + ClipGDI->EnumOrder = BuildOrder; + } + + /* Return the number of rectangles enumerated */ + if ((MaxRects > 0) && (ClipGDI->EnumRects.c > MaxRects)) + { + return 0xFFFFFFFF; + } + + return ClipGDI->EnumRects.c; } /* * @implemented */ BOOL STDCALL -CLIPOBJ_bEnum(IN CLIPOBJ* ClipObj, - IN ULONG ObjSize, - OUT ULONG *EnumRects) -{ - RECTL *dest, *src; - CLIPGDI *ClipGDI = ObjToGDI(ClipObj, CLIP); - ULONG nCopy, i; - ENUMRECTS* pERects = (ENUMRECTS*)EnumRects; - - //calculate how many rectangles we should copy - nCopy = min( ClipGDI->EnumMax - ClipGDI->EnumPos, - min( ClipGDI->EnumRects.c - ClipGDI->EnumPos, - (ObjSize - sizeof(ULONG)) / sizeof(RECTL))); - if(nCopy == 0) - { - return FALSE; - } - - /* copy rectangles */ - src = ClipGDI->EnumRects.arcl + ClipGDI->EnumPos; - for(i = 0, dest = pERects->arcl; - i < nCopy; - i++, dest++, src++) - { - *dest = *src; - } - - pERects->c = nCopy; - - ClipGDI->EnumPos+=nCopy; - - return ClipGDI->EnumPos < ClipGDI->EnumRects.c; +CLIPOBJ_bEnum( + IN CLIPOBJ* ClipObj, + IN ULONG ObjSize, + OUT ULONG *EnumRects) +{ + RECTL *dest, *src; + CLIPGDI *ClipGDI = ObjToGDI(ClipObj, CLIP); + ULONG nCopy, i; + ENUMRECTS* pERects = (ENUMRECTS*)EnumRects; + + //calculate how many rectangles we should copy + nCopy = min( ClipGDI->EnumMax - ClipGDI->EnumPos, + min( ClipGDI->EnumRects.c - ClipGDI->EnumPos, + (ObjSize - sizeof(ULONG)) / sizeof(RECTL))); + + if(nCopy == 0) + { + return FALSE; + } + + /* copy rectangles */ + src = ClipGDI->EnumRects.arcl + ClipGDI->EnumPos; + for(i = 0, dest = pERects->arcl; i < nCopy; i++, dest++, src++) + { + *dest = *src; + } + + pERects->c = nCopy; + + ClipGDI->EnumPos+=nCopy; + + return ClipGDI->EnumPos < ClipGDI->EnumRects.c; } BOOLEAN FASTCALL -ClipobjToSpans(PSPAN *Spans, UINT *Count, CLIPOBJ *ClipRegion, PRECTL Boundary) -{ - BOOL EnumMore; - UINT i, NewCount; - RECT_ENUM RectEnum; - PSPAN NewSpans; - RECTL *Rect; - - ASSERT(Boundary->top <= Boundary->bottom && Boundary->left <= Boundary->right); - - *Spans = NULL; - if (NULL == ClipRegion || DC_TRIVIAL == ClipRegion->iDComplexity) - { - *Count = Boundary->bottom - Boundary->top; - if (0 != *Count) - { - *Spans = ExAllocatePoolWithTag(PagedPool, *Count * sizeof(SPAN), TAG_CLIP); - if (NULL == *Spans) - { - *Count = 0; - return FALSE; - } - for (i = 0; i < Boundary->bottom - Boundary->top; i++) - { - (*Spans)[i].X = Boundary->left; - (*Spans)[i].Y = Boundary->top + i; - (*Spans)[i].Width = Boundary->right - Boundary->left; +ClipobjToSpans( + PSPAN *Spans, + UINT *Count, + CLIPOBJ *ClipRegion, + PRECTL Boundary) +{ + BOOL EnumMore; + UINT i, NewCount; + RECT_ENUM RectEnum; + PSPAN NewSpans; + RECTL *Rect; + + ASSERT(Boundary->top <= Boundary->bottom && Boundary->left <= Boundary->right); + + *Spans = NULL; + if (NULL == ClipRegion || DC_TRIVIAL == ClipRegion->iDComplexity) + { + *Count = Boundary->bottom - Boundary->top; + if (0 != *Count) + { + *Spans = ExAllocatePoolWithTag(PagedPool, *Count * sizeof(SPAN), TAG_CLIP); + if (NULL == *Spans) + { + *Count = 0; + return FALSE; + } + for (i = 0; i < Boundary->bottom - Boundary->top; i++) + { + (*Spans)[i].X = Boundary->left; + (*Spans)[i].Y = Boundary->top + i; + (*Spans)[i].Width = Boundary->right - Boundary->left; } } return TRUE; } - *Count = 0; - CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0); - do - { - EnumMore = CLIPOBJ_bEnum(ClipRegion, (ULONG) sizeof(RECT_ENUM), (PVOID) &RectEnum); - - NewCount = *Count; - for (i = 0; i < RectEnum.c; i++) - { - NewCount += RectEnum.arcl[i].bottom - RectEnum.arcl[i].top; - } - if (NewCount != *Count) - { - NewSpans = ExAllocatePoolWithTag(PagedPool, NewCount * sizeof(SPAN), TAG_CLIP); - if (NULL == NewSpans) - { - if (NULL != *Spans) + *Count = 0; + CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0); + do + { + EnumMore = CLIPOBJ_bEnum(ClipRegion, (ULONG) sizeof(RECT_ENUM), (PVOID) &RectEnum); + + NewCount = *Count; + for (i = 0; i < RectEnum.c; i++) + { + NewCount += RectEnum.arcl[i].bottom - RectEnum.arcl[i].top; + } + if (NewCount != *Count) + { + NewSpans = ExAllocatePoolWithTag(PagedPool, NewCount * sizeof(SPAN), TAG_CLIP); + if (NULL == NewSpans) + { + if (NULL != *Spans) { - ExFreePool(*Spans); - *Spans = NULL; + ExFreePool(*Spans); + *Spans = NULL; } - *Count = 0; - return FALSE; - } - if (0 != *Count) - { - PSPAN dest, src; - UINT i = *Count; - for(dest = NewSpans, src = *Spans; - i > 0; - i--) - { - *dest++ = *src++; - } - ExFreePool(*Spans); - } - *Spans = NewSpans; - } - for (Rect = RectEnum.arcl; Rect < RectEnum.arcl + RectEnum.c; Rect++) - { - for (i = 0; i < Rect->bottom - Rect->top; i++) - { - (*Spans)[*Count].X = Rect->left; - (*Spans)[*Count].Y = Rect->top + i; - (*Spans)[*Count].Width = Rect->right - Rect->left; - (*Count)++; - } - } - ASSERT(*Count == NewCount); - } - while (EnumMore); - - if (0 != *Count) - { - EngSort((PBYTE) *Spans, sizeof(SPAN), *Count, (SORTCOMP) CompareSpans); - } - - return TRUE; + *Count = 0; + return FALSE; + } + if (0 != *Count) + { + PSPAN dest, src; + UINT i = *Count; + for(dest = NewSpans, src = *Spans;i > 0; i--) + { + *dest++ = *src++; + } + ExFreePool(*Spans); + } + *Spans = NewSpans; + } + for (Rect = RectEnum.arcl; Rect < RectEnum.arcl + RectEnum.c; Rect++) + { + for (i = 0; i < Rect->bottom - Rect->top; i++) + { + (*Spans)[*Count].X = Rect->left; + (*Spans)[*Count].Y = Rect->top + i; + (*Spans)[*Count].Width = Rect->right - Rect->left; + (*Count)++; + } + } + ASSERT(*Count == NewCount); + } + while (EnumMore); + + if (0 != *Count) + { + EngSort((PBYTE) *Spans, sizeof(SPAN), *Count, (SORTCOMP) CompareSpans); + } + + return TRUE; } /* EOF */
16 years, 6 months
1
0
0
0
[jimtabor] 33894: Update NtUserInitializeClientPfnArrays add additional structures and types for future support.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sat Jun 7 22:34:25 2008 New Revision: 33894 URL:
http://svn.reactos.org/svn/reactos?rev=33894&view=rev
Log: Update NtUserInitializeClientPfnArrays add additional structures and types for future support. Modified: trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sat Jun 7 22:34:25 2008 @@ -168,6 +168,93 @@ UINT HideFocus : 1; UINT HideAccel : 1; } WINDOW, *PWINDOW; + +typedef struct _PFNCLIENT +{ + PROC pfnScrollBarC; + PROC pfnDefWndC; + PROC pfnMenuC; + PROC pfnDesktopC; + PROC pfnDefWnd1C; + PROC pfnDefWnd2C; + PROC pfnDefWnd3C; + PROC pfnButtomC; + PROC pfnComboBoxC; + PROC pfnComboListBoxC; + PROC pfnDefDlgC; + PROC pfnEditC; + PROC pfnListBoxC; + PROC pfnMDIClientC; + PROC pfnStaticC; + PROC pfnImeC; + PROC pfnHkINLPCWPSTRUCT; + PROC pfnHkINLPCWPRETSTRUCT; + PROC pfnDispatchHookC; + PROC pfnDispatchDefC; +} PFNCLIENT, *PPFNCLIENT; + +typedef struct _PFNCLIENTWORKER +{ + PROC pfnButtonCW; + PROC pfnComboBoxCW; + PROC pfnComboListBoxCW; + PROC pfnDefDlgCW; + PROC pfnEditCW; + PROC pfnListBoxCW; + PROC pfnMDIClientCW; + PROC pfnStaticCW; + PROC pfnImeCW; +} PFNCLIENTWORKER, *PPFNCLIENTWORKER; + + +// FNID's for NtUserSetWindowFNID +#define FNID_SCROLLBAR 0x029A +#define FNID_ICONTITLE 0x029B +#define FNID_MENU 0x029C +#define FNID_DESKTOP 0x029D +#define FNID_SWITCH 0x02A0 +#define FNID_BUTTON 0x02A1 +#define FNID_COMBOBOX 0x02A2 +#define FNID_COMBOLBOX 0x02A3 +#define FNID_DIALOG 0x02A4 +#define FNID_EDIT 0x02A5 +#define FNID_LISTBOX 0x02A6 +#define FNID_MDICLIENT 0x02A7 +#define FNID_STATIC 0x02A8 +#define FNID_IME 0x02A9 +#define FNID_TOOLTIPS 0x02B5 +#define FNID_UNKNOWN 0x02B6 + +#define FNID_DDEML 0x2000 // Registers DDEML +#define FNID_DESTROY 0x4000 // This is sent when WM_NCDESTROY or in the support routine. + // Seen during WM_CREATE on error exit too. + +// ICLS's for NtUserGetClassName FNID to ICLS, NtUserInitializeClientPfnArrays +#define ICLS_BUTTON 0 +#define ICLS_EDIT 1 +#define ICLS_STATIC 2 +#define ICLS_LISTBOX 3 +#define ICLS_SCROLLBAR 4 +#define ICLS_COMBOBOX 5 +#define ICLS_MDICLIENT 6 +#define ICLS_COMBOLBOX 7 +#define ICLS_DDEMLEVENT 8 +#define ICLS_DDEMLMOTHER 9 +#define ICLS_DDEML16BIT 10 +#define ICLS_DDEMLCLIENTA 11 +#define ICLS_DDEMLCLIENTW 12 +#define ICLS_DDEMLSERVERA 13 +#define ICLS_DDEMLSERVERW 14 +#define ICLS_IME 15 +#define ICLS_DESKTOP 16 +#define ICLS_DIALOG 17 +#define ICLS_MENU 18 +#define ICLS_SWITCH 19 +#define ICLS_ICONTITLE 20 +#define ICLS_TOOLTIPS 21 +#define ICLS_UNKNOWN 22 +#define ICLS_NOTUSED 23 +#define ICLS_END 31 #define SRVINFO_METRICS 0x0020 @@ -271,32 +358,6 @@ PW32THREADINFO GetW32ThreadInfo(VOID); PW32PROCESSINFO GetW32ProcessInfo(VOID); -// FNID's for NtUserSetWindowFNID -#define FNID_BUTTON 0x02A1 -#define FNID_COMBOBOX 0x02A2 -#define FNID_COMBOLBOX 0x02A3 -#define FNID_DIALOG 0x02A4 -#define FNID_EDIT 0x02A5 -#define FNID_LISTBOX 0x02A6 -#define FNID_MDICLIENT 0x02A7 -#define FNID_STATIC 0x02A8 -#define FNID_IME 0x02A9 - -#define FNID_DDEML 0x2000 // Registers DDEML -#define FNID_DESTROY 0x4000 // This is sent when WM_NCDESTROY or in the support routine. - // Seen during WM_CREATE on error exit too. - -// ICLS's for NtUserGetClassName FNID to ICLS -#define ICLS_BUTTON 0 -#define ICLS_EDIT 1 -#define ICLS_STATIC 2 -#define ICLS_LISTBOX 3 -#define ICLS_COMBOBOX 5 -#define ICLS_MDICLIENT 6 -#define ICLS_COMBOLBOX 7 -#define ICLS_IME 15 -#define ICLS_DIALOG 17 -#define ICLS_END 31 DWORD NTAPI @@ -1557,13 +1618,13 @@ DWORD dwUnknown2, DWORD dwUnknown3); -DWORD +NTSTATUS NTAPI NtUserInitializeClientPfnArrays( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3); + PPFNCLIENT pfnClientA, + PPFNCLIENT pfnClientW, + PPFNCLIENTWORKER pfnClientWorker, + HINSTANCE hmodUser); DWORD NTAPI Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] Sat Jun 7 22:34:25 2008 @@ -348,17 +348,17 @@ return 0; } -DWORD +NTSTATUS STDCALL NtUserInitializeClientPfnArrays( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3) -{ - UNIMPLEMENTED - - return 0; + PPFNCLIENT pfnClientA, + PPFNCLIENT pfnClientW, + PPFNCLIENTWORKER pfnClientWorker, + HINSTANCE hmodUser) +{ + UNIMPLEMENTED + + return STATUS_UNSUCCESSFUL; } DWORD
16 years, 6 months
1
0
0
0
[tkreuzer] 33893: Fix some region leaks: GdiSelectVisRgn copies the region, so the given one it must be deleted afterwards. This code is not perfect ~ as Jim already said, not completed. But it's at least working correctly now. Say welcome to a stable running Firefox 1.5. Also added some DPRINTs on failures.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jun 7 19:43:07 2008 New Revision: 33893 URL:
http://svn.reactos.org/svn/reactos?rev=33893&view=rev
Log: Fix some region leaks: GdiSelectVisRgn copies the region, so the given one it must be deleted afterwards. This code is not perfect ~ as Jim already said, not completed. But it's at least working correctly now. Say welcome to a stable running Firefox 1.5. Also added some DPRINTs on failures. Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Sat Jun 7 19:43:07 2008 @@ -72,6 +72,7 @@ DisplayDC = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, TRUE); if (NULL == DisplayDC) { + DPRINT1("Failed to create DisplayDC\n"); return NULL; } hDC = DisplayDC; @@ -85,11 +86,13 @@ { NtGdiDeleteObjectApp(DisplayDC); } + DPRINT1("Failed to lock hDC\n"); return NULL; } hNewDC = DC_AllocDC(&OrigDC->DriverName); if (NULL == hNewDC) { + DPRINT1("Failed to create hNewDC\n"); DC_UnlockDc(OrigDC); if (NULL != DisplayDC) { @@ -98,6 +101,13 @@ return NULL; } NewDC = DC_LockDc( hNewDC ); + + if(!NewDC) + { + DPRINT1("Failed to lock hNewDC\n"); + NtGdiDeleteObjectApp(hNewDC); + return NULL; + } oDc_Attr = OrigDC->pDc_Attr; if(!oDc_Attr) oDc_Attr = &OrigDC->Dc_Attr; @@ -142,7 +152,11 @@ } hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1); - GdiSelectVisRgn(hNewDC, hVisRgn); + if (hVisRgn) + { + GdiSelectVisRgn(hNewDC, hVisRgn); + NtGdiDeleteObject(hVisRgn); + } if (Layout) NtGdiSetLayout( hNewDC, -1, Layout); DC_InitDC(hNewDC); @@ -779,13 +793,16 @@ /* Check for existing DC object */ if ((hNewDC = DC_FindOpenDC(Driver)) != NULL) { - hDC = hNewDC; - return NtGdiCreateCompatibleDC(hDC); + hDC = NtGdiCreateCompatibleDC(hNewDC); + if (!hDC) + DPRINT1("NtGdiCreateCompatibleDC() failed\n"); + return hDC; } /* Allocate a DC object */ if ((hNewDC = DC_AllocDC(Driver)) == NULL) { + DPRINT1("DC_AllocDC() failed\n"); return NULL; } @@ -793,6 +810,7 @@ if ( !NewDC ) { DC_FreeDC( hNewDC ); + DPRINT1("DC_LockDc() failed\n"); return NULL; } @@ -828,7 +846,11 @@ hVisRgn = NtGdiCreateRectRgn(0, 0, ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulHorzRes, ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulVertRes); - GdiSelectVisRgn(hNewDC, hVisRgn); + if (hVisRgn) + { + GdiSelectVisRgn(hNewDC, hVisRgn); + NtGdiDeleteObject(hVisRgn); + } /* Initialize the DC state */ DC_InitDC(hNewDC); @@ -1960,7 +1982,12 @@ hVisRgn = NtGdiCreateRectRgn(0, 0, pBmp->SurfObj.sizlBitmap.cx, pBmp->SurfObj.sizlBitmap.cy); BITMAPOBJ_UnlockBitmap(pBmp); - GdiSelectVisRgn(hDC, hVisRgn); + + if (hVisRgn) + { + GdiSelectVisRgn(hDC, hVisRgn); + NtGdiDeleteObject(hVisRgn); + } return hOrgBmp; } @@ -2422,6 +2449,7 @@ Buf = ExAllocatePoolWithTag(PagedPool, Driver->MaximumLength, TAG_DC); if(!Buf) { + DPRINT1("ExAllocatePoolWithTag failed\n"); return NULL; } RtlCopyMemory(Buf, Driver->Buffer, Driver->MaximumLength); @@ -2434,6 +2462,7 @@ { ExFreePool(Buf); } + DPRINT1("GDIOBJ_AllocObjWithHandle failed\n"); return NULL; }
16 years, 6 months
1
0
0
0
[ekohl] 33892: Real fix for the broken netapi32.dll.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Jun 7 17:50:55 2008 New Revision: 33892 URL:
http://svn.reactos.org/svn/reactos?rev=33892&view=rev
Log: Real fix for the broken netapi32.dll. Modified: trunk/reactos/dll/cpl/usrmgr/userprops.c Modified: trunk/reactos/dll/cpl/usrmgr/userprops.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/userprops.c…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] Sat Jun 7 17:50:55 2008 @@ -260,7 +260,9 @@ LPTSTR pszFullName = NULL; LPTSTR pszComment = NULL; NET_API_STATUS status; +#if 0 DWORD dwIndex; +#endif INT nLength; NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo); @@ -297,13 +299,13 @@ #if 0 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex); + if (status != NERR_Success) + { + DebugPrintf(_T("Status: %lu Index: %lu"), status, dwIndex); + } #else status = NERR_Success; #endif - if (status != NERR_Success) - { - DebugPrintf(_T("Status: %lu Index: %lu"), status, dwIndex); - } if (pszFullName) HeapFree(GetProcessHeap(), 0, pszFullName);
16 years, 6 months
1
0
0
0
[ekohl] 33891: Fix for broken netapi32.dll.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Jun 7 17:44:15 2008 New Revision: 33891 URL:
http://svn.reactos.org/svn/reactos?rev=33891&view=rev
Log: Fix for broken netapi32.dll. Modified: trunk/reactos/dll/cpl/usrmgr/userprops.c Modified: trunk/reactos/dll/cpl/usrmgr/userprops.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/userprops.c…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] Sat Jun 7 17:44:15 2008 @@ -295,7 +295,11 @@ pUserInfo->usri3_comment = pszComment; } +#if 0 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex); +#else + status = NERR_Success; +#endif if (status != NERR_Success) { DebugPrintf(_T("Status: %lu Index: %lu"), status, dwIndex);
16 years, 6 months
1
0
0
0
[ekohl] 33890: - Group properties: Display the SID of well-known members. - User properties: Store changes to the general settings.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Jun 7 17:31:24 2008 New Revision: 33890 URL:
http://svn.reactos.org/svn/reactos?rev=33890&view=rev
Log: - Group properties: Display the SID of well-known members. - User properties: Store changes to the general settings. Modified: trunk/reactos/dll/cpl/usrmgr/groupprops.c trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc trunk/reactos/dll/cpl/usrmgr/userprops.c trunk/reactos/dll/cpl/usrmgr/users.c trunk/reactos/dll/cpl/usrmgr/usrmgr.h trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild Modified: trunk/reactos/dll/cpl/usrmgr/groupprops.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/groupprops.…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/groupprops.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/groupprops.c [iso-8859-1] Sat Jun 7 17:31:24 2008 @@ -8,6 +8,56 @@ */ #include "usrmgr.h" + +typedef struct _GENERAL_GROUP_DATA +{ + TCHAR szGroupName[1]; +} GENERAL_GROUP_DATA, *PGENERAL_GROUP_DATA; + + +static VOID +GetTextSid(PSID pSid, + LPTSTR pTextSid) +{ + PSID_IDENTIFIER_AUTHORITY psia; + DWORD dwSubAuthorities; + DWORD dwSidRev = SID_REVISION; + DWORD dwCounter; + DWORD dwSidSize; + + psia = GetSidIdentifierAuthority(pSid); + + dwSubAuthorities = *GetSidSubAuthorityCount(pSid); + + dwSidSize = wsprintf(pTextSid, TEXT("S-%lu-"), dwSidRev); + + if ((psia->Value[0] != 0) || (psia->Value[1] != 0)) + { + dwSidSize += wsprintf(pTextSid + lstrlen(pTextSid), + TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"), + (USHORT)psia->Value[0], + (USHORT)psia->Value[1], + (USHORT)psia->Value[2], + (USHORT)psia->Value[3], + (USHORT)psia->Value[4], + (USHORT)psia->Value[5]); + } + else + { + dwSidSize += wsprintf(pTextSid + lstrlen(pTextSid), + TEXT("%lu"), + (ULONG)(psia->Value[5]) + + (ULONG)(psia->Value[4] << 8) + + (ULONG)(psia->Value[3] << 16) + + (ULONG)(psia->Value[2] << 24)); + } + + for (dwCounter = 0 ; dwCounter < dwSubAuthorities ; dwCounter++) + { + dwSidSize += wsprintf(pTextSid + dwSidSize, TEXT("-%lu"), + *GetSidSubAuthority(pSid, dwCounter)); + } +} static VOID @@ -25,6 +75,8 @@ RECT rect; HIMAGELIST hImgList; HICON hIcon; + TCHAR szGroupName[256]; + hwndLV = GetDlgItem(hwndDlg, IDC_GROUP_GENERAL_MEMBERS); @@ -70,6 +122,21 @@ lvi.iImage = (membersInfo[i].lgrmi1_sidusage == SidTypeGroup || membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) ? 1 : 0; + if (membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) + { + TCHAR szSid[256]; + + GetTextSid(membersInfo[i].lgrmi1_sid, szSid); + + wsprintf(szGroupName, + TEXT("%s\\%s (%s)"), + + membersInfo[i].lgrmi1_name, + szSid); + + lvi.pszText = szGroupName; + } + (void)ListView_InsertItem(hwndLV, &lvi); } @@ -118,7 +185,7 @@ } -VOID +BOOL GroupProperties(HWND hwndDlg) { PROPSHEETPAGE psp[1]; @@ -130,7 +197,7 @@ hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST); nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED); if (nItem == -1) - return; + return FALSE; /* Get the new user name */ ListView_GetItemText(hwndLV, @@ -151,5 +218,5 @@ InitPropSheetPage(&psp[0], IDD_GROUP_GENERAL, (DLGPROC)GroupGeneralPageProc, szGroupName); - PropertySheet(&psh); -} + return (PropertySheet(&psh) == IDOK); +} Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/lang/en-US.…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] Sat Jun 7 17:31:24 2008 @@ -50,7 +50,7 @@ AUTOCHECKBOX "User cannot change the password",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 AUTOCHECKBOX "Password never expires",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 AUTOCHECKBOX "Account is disabled",IDC_USER_GENERAL_DISABLED,7,121,210,10 - AUTOCHECKBOX "Account is locked",IDC_USER_GENERAL_LOCKED,7,134,210,10,WS_DISABLED + AUTOCHECKBOX "Account is locked",IDC_USER_GENERAL_LOCKED,7,134,210,10 END Modified: trunk/reactos/dll/cpl/usrmgr/userprops.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/userprops.c…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] Sat Jun 7 17:31:24 2008 @@ -8,6 +8,16 @@ */ #include "usrmgr.h" + +typedef struct _GENERAL_USER_DATA +{ + DWORD dwFlags; + DWORD dwPasswordExpired; + TCHAR szUserName[1]; +} GENERAL_USER_DATA, *PGENERAL_USER_DATA; + +#define VALID_GENERAL_FLAGS (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD | UF_ACCOUNTDISABLE | UF_LOCKOUT) + static VOID @@ -187,48 +197,116 @@ static VOID UpdateUserOptions(HWND hwndDlg, - PUSER_INFO_3 userInfo, + PGENERAL_USER_DATA pUserData, BOOL bInit) { EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_CANNOT_CHANGE), - !userInfo->usri3_password_expired); + !pUserData->dwPasswordExpired); EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_NEVER_EXPIRES), - !userInfo->usri3_password_expired); + !pUserData->dwPasswordExpired); EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_FORCE_CHANGE), - (userInfo->usri3_flags & (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD)) == 0); + (pUserData->dwFlags & (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD)) == 0); + + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_LOCKED), + (pUserData->dwFlags & UF_LOCKOUT) != 0); if (bInit) { CheckDlgButton(hwndDlg, IDC_USER_GENERAL_FORCE_CHANGE, - userInfo->usri3_password_expired ? BST_CHECKED : BST_UNCHECKED); + pUserData->dwPasswordExpired ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_USER_GENERAL_CANNOT_CHANGE, - (userInfo->usri3_flags & UF_PASSWD_CANT_CHANGE) ? BST_CHECKED : BST_UNCHECKED); + (pUserData->dwFlags & UF_PASSWD_CANT_CHANGE) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_USER_GENERAL_NEVER_EXPIRES, - (userInfo->usri3_flags & UF_DONT_EXPIRE_PASSWD) ? BST_CHECKED : BST_UNCHECKED); + (pUserData->dwFlags & UF_DONT_EXPIRE_PASSWD) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_USER_GENERAL_DISABLED, - (userInfo->usri3_flags & UF_ACCOUNTDISABLE) ? BST_CHECKED : BST_UNCHECKED); + (pUserData->dwFlags & UF_ACCOUNTDISABLE) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_USER_GENERAL_LOCKED, + (pUserData->dwFlags & UF_LOCKOUT) ? BST_CHECKED : BST_UNCHECKED); } } static VOID -GetUserData(HWND hwndDlg, LPTSTR lpUserName, PUSER_INFO_3 *usrInfo) -{ - PUSER_INFO_3 userInfo = NULL; - - SetDlgItemText(hwndDlg, IDC_USER_GENERAL_NAME, lpUserName); - - NetUserGetInfo(NULL, lpUserName, 3, (LPBYTE*)&userInfo); - - SetDlgItemText(hwndDlg, IDC_USER_GENERAL_FULL_NAME, userInfo->usri3_full_name); - SetDlgItemText(hwndDlg, IDC_USER_GENERAL_DESCRIPTION, userInfo->usri3_comment); - - UpdateUserOptions(hwndDlg, userInfo, TRUE); - - *usrInfo = userInfo; +GetGeneralUserData(HWND hwndDlg, + PGENERAL_USER_DATA pUserData) +{ + PUSER_INFO_3 pUserInfo = NULL; + + SetDlgItemText(hwndDlg, IDC_USER_GENERAL_NAME, pUserData->szUserName); + + NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo); + + SetDlgItemText(hwndDlg, IDC_USER_GENERAL_FULL_NAME, pUserInfo->usri3_full_name); + SetDlgItemText(hwndDlg, IDC_USER_GENERAL_DESCRIPTION, pUserInfo->usri3_comment); + + pUserData->dwFlags = pUserInfo->usri3_flags; + pUserData->dwPasswordExpired = pUserInfo->usri3_password_expired; + + NetApiBufferFree(pUserInfo); + + UpdateUserOptions(hwndDlg, pUserData, TRUE); +} + + +static BOOL +SetGeneralUserData(HWND hwndDlg, + PGENERAL_USER_DATA pUserData) +{ + PUSER_INFO_3 pUserInfo = NULL; + LPTSTR pszFullName = NULL; + LPTSTR pszComment = NULL; + NET_API_STATUS status; + DWORD dwIndex; + INT nLength; + + NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo); + + pUserInfo->usri3_flags = + (pUserData->dwFlags & VALID_GENERAL_FLAGS) | + (pUserInfo->usri3_flags & ~VALID_GENERAL_FLAGS); + + pUserInfo->usri3_password_expired = pUserData->dwPasswordExpired; + + nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_GENERAL_FULL_NAME)); + if (nLength == 0) + { + pUserInfo->usri3_full_name = NULL; + } + else + { + pszFullName = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); + GetDlgItemText(hwndDlg, IDC_USER_GENERAL_FULL_NAME, pszFullName, nLength + 1); + pUserInfo->usri3_full_name = pszFullName; + } + + nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_GENERAL_DESCRIPTION)); + if (nLength == 0) + { + pUserInfo->usri3_full_name = NULL; + } + else + { + pszComment = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); + GetDlgItemText(hwndDlg, IDC_USER_GENERAL_DESCRIPTION, pszComment, nLength + 1); + pUserInfo->usri3_comment = pszComment; + } + + status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex); + if (status != NERR_Success) + { + DebugPrintf(_T("Status: %lu Index: %lu"), status, dwIndex); + } + + if (pszFullName) + HeapFree(GetProcessHeap(), 0, pszFullName); + + NetApiBufferFree(pUserInfo); + + return (status == NERR_Success); } @@ -238,52 +316,72 @@ WPARAM wParam, LPARAM lParam) { - PUSER_INFO_3 userInfo; + PGENERAL_USER_DATA pUserData; UNREFERENCED_PARAMETER(lParam); UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(hwndDlg); - userInfo = (PUSER_INFO_3)GetWindowLongPtr(hwndDlg, DWLP_USER); + pUserData= (PGENERAL_USER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); switch (uMsg) { case WM_INITDIALOG: - GetUserData(hwndDlg, - (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam, - &userInfo); - SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)userInfo); + pUserData = (PGENERAL_USER_DATA)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(GENERAL_USER_DATA) + + lstrlen((LPTSTR)((PROPSHEETPAGE *)lParam)->lParam) * sizeof(TCHAR)); + lstrcpy(pUserData->szUserName, (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam); + + GetGeneralUserData(hwndDlg, + pUserData); + + SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_USER_GENERAL_FORCE_CHANGE: - userInfo->usri3_password_expired = !userInfo->usri3_password_expired; - UpdateUserOptions(hwndDlg, userInfo, FALSE); + pUserData->dwPasswordExpired = !pUserData->dwPasswordExpired; + UpdateUserOptions(hwndDlg, pUserData, FALSE); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; case IDC_USER_GENERAL_CANNOT_CHANGE: - userInfo->usri3_flags ^= UF_PASSWD_CANT_CHANGE; - UpdateUserOptions(hwndDlg, userInfo, FALSE); + pUserData->dwFlags ^= UF_PASSWD_CANT_CHANGE; + UpdateUserOptions(hwndDlg, pUserData, FALSE); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; case IDC_USER_GENERAL_NEVER_EXPIRES: - userInfo->usri3_flags ^= UF_DONT_EXPIRE_PASSWD; - UpdateUserOptions(hwndDlg, userInfo, FALSE); + pUserData->dwFlags ^= UF_DONT_EXPIRE_PASSWD; + UpdateUserOptions(hwndDlg, pUserData, FALSE); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; case IDC_USER_GENERAL_DISABLED: - userInfo->usri3_flags ^= UF_ACCOUNTDISABLE; + pUserData->dwFlags ^= UF_ACCOUNTDISABLE; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; case IDC_USER_GENERAL_LOCKED: + pUserData->dwFlags ^= UF_LOCKOUT; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } break; + case WM_NOTIFY: + if (((LPPSHNOTIFY)lParam)->hdr.code == PSN_APPLY) + { + SetGeneralUserData(hwndDlg, pUserData); + return TRUE; + } + break; + case WM_DESTROY: - NetApiBufferFree(userInfo); + HeapFree(GetProcessHeap(), 0, pUserData); break; } @@ -304,7 +402,7 @@ } -VOID +BOOL UserProperties(HWND hwndDlg) { PROPSHEETPAGE psp[3]; @@ -316,7 +414,7 @@ hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST); nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED); if (nItem == -1) - return; + return FALSE; /* Get the new user name */ ListView_GetItemText(hwndLV, @@ -339,5 +437,5 @@ InitPropSheetPage(&psp[1], IDD_USER_MEMBERSHIP, (DLGPROC)UserMembershipPageProc, szUserName); InitPropSheetPage(&psp[2], IDD_USER_PROFILE, (DLGPROC)UserProfilePageProc, szUserName); - PropertySheet(&psh); -} + return (PropertySheet(&psh) == IDOK); +} Modified: trunk/reactos/dll/cpl/usrmgr/users.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/users.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] Sat Jun 7 17:31:24 2008 @@ -596,6 +596,46 @@ } +static VOID +UpdateUserProperties(HWND hwndDlg) +{ + TCHAR szUserName[UNLEN]; + INT iItem; + HWND hwndLV; + NET_API_STATUS status; + PUSER_INFO_2 pUserInfo = NULL; + LV_ITEM lvi; + + hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST); + iItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED); + if (iItem == -1) + return; + + /* Get the new user name */ + ListView_GetItemText(hwndLV, + iItem, 0, + szUserName, + UNLEN); + + status = NetUserGetInfo(NULL, szUserName, 2, (LPBYTE*)&pUserInfo); + + memset(&lvi, 0x00, sizeof(lvi)); + lvi.iItem = iItem; + lvi.iSubItem = 0; + lvi.mask = LVIF_IMAGE; + lvi.iImage = (pUserInfo->usri2_flags & UF_ACCOUNTDISABLE) ? 1 : 0; + (void)ListView_SetItem(hwndLV, &lvi); + + ListView_SetItemText(hwndLV, iItem, 1, + pUserInfo->usri2_full_name); + + ListView_SetItemText(hwndLV, iItem, 2, + pUserInfo->usri2_comment); + + NetApiBufferFree(pUserInfo); +} + + INT_PTR CALLBACK UsersPageProc(HWND hwndDlg, UINT uMsg, @@ -646,7 +686,10 @@ break; case IDM_USER_PROPERTIES: - UserProperties(hwndDlg); + if (UserProperties(hwndDlg)) + { + UpdateUserProperties(hwndDlg); + } break; } break; Modified: trunk/reactos/dll/cpl/usrmgr/usrmgr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/usrmgr.h?re…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/usrmgr.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/usrmgr.h [iso-8859-1] Sat Jun 7 17:31:24 2008 @@ -30,7 +30,7 @@ INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); /* groupprops.c */ -VOID +BOOL GroupProperties(HWND hwndDlg); /* misc.c */ @@ -43,7 +43,7 @@ LPTSTR lpAccountName); /* userprops.c */ -VOID +BOOL UserProperties(HWND hwndDlg); #endif /* __CPL_DESK_H__ */ Modified: trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/usrmgr.rbui…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild [iso-8859-1] Sat Jun 7 17:31:24 2008 @@ -7,6 +7,7 @@ <define name="_WIN32_WINNT">0x501</define> <define name="WINVER">0x609</define> <library>kernel32</library> + <library>advapi32</library> <library>user32</library> <library>gdi32</library> <library>comctl32</library>
16 years, 6 months
1
0
0
0
[hpoussin] 33889: Write the complete error message to debug log, instead of partial information
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Jun 7 15:44:57 2008 New Revision: 33889 URL:
http://svn.reactos.org/svn/reactos?rev=33889&view=rev
Log: Write the complete error message to debug log, instead of partial information Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] Sat Jun 7 15:44:57 2008 @@ -195,8 +195,8 @@ HardErrorMessage->Response = ResponseNotHandled; - DPRINT1("NumberOfParameters = %d\n", HardErrorMessage->NumberOfParameters); - DPRINT1("Status = %lx\n", HardErrorMessage->Status); + DPRINT("NumberOfParameters = %d\n", HardErrorMessage->NumberOfParameters); + DPRINT("Status = %lx\n", HardErrorMessage->Status); // open client process InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); @@ -514,6 +514,7 @@ } // FIXME: We should not use MessageBox !!!! + DPRINT1("%S\n", szxMessageBody); MessageBoxResponse = MessageBoxW(0, szxMessageBody, szxCaptionText, responce|MB_ICONERROR|MB_SYSTEMMODAL|MB_SETFOREGROUND); RtlFreeHeap (RtlGetProcessHeap(), 0, szxMessageBody);
16 years, 6 months
1
0
0
0
[greatlrd] 33888: add a missing asseert
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sat Jun 7 09:55:59 2008 New Revision: 33888 URL:
http://svn.reactos.org/svn/reactos?rev=33888&view=rev
Log: add a missing asseert Modified: branches/win32k-gdi-dx/subsystems/win32/win32k/objects/bitblt.c Modified: branches/win32k-gdi-dx/subsystems/win32/win32k/objects/bitblt.c URL:
http://svn.reactos.org/svn/reactos/branches/win32k-gdi-dx/subsystems/win32/…
============================================================================== --- branches/win32k-gdi-dx/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] (original) +++ branches/win32k-gdi-dx/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Sat Jun 7 09:55:59 2008 @@ -958,6 +958,7 @@ BOOL ret = TRUE; ASSERT(BrushObj); + ASSERT(dc); BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap); if (BitmapObj == NULL)
16 years, 6 months
1
0
0
0
← Newer
1
...
31
32
33
34
35
36
37
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200