"Fossies" - the Fresh Open Source Software Archive

Member "libgdiplus-6.0.2/tests/testtexturebrush.c" (31 Jul 2019, 72281 Bytes) of package /linux/misc/mono-sources/libgdiplus/libgdiplus-6.0.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #ifdef WIN32
    2 #ifndef __cplusplus
    3 #error Please compile with a C++ compiler.
    4 #endif
    5 #endif
    6 
    7 #if defined(USE_WINDOWS_GDIPLUS)
    8 #include <Windows.h>
    9 #include <GdiPlus.h>
   10 
   11 #pragma comment(lib, "gdiplus.lib")
   12 #else
   13 #include <GdiPlusFlat.h>
   14 #endif
   15 
   16 #if defined(USE_WINDOWS_GDIPLUS)
   17 using namespace Gdiplus;
   18 using namespace DllExports;
   19 #endif
   20 
   21 #include <assert.h>
   22 #include <stdio.h>
   23 #include <stdlib.h>
   24 #include "testhelpers.h"
   25 
   26 const WCHAR bitmapFile[] = {'t', 'e', 's', 't', '.', 'b', 'm', 'p', 0};
   27 const WCHAR wmfFile[] = {'t', 'e', 's', 't', '.', 'w', 'm', 'f', 0};
   28 const WCHAR emfFile[] = {'t', 'e', 's', 't', '.', 'e', 'm', 'f', 0};
   29 
   30 static void verifyTexture (GpTexture *brush, GpWrapMode expectedWrapMode, REAL expectedBrushWidth, REAL expectedBrushHeight)
   31 {
   32     assert (brush && "Expected the brush to be initialized.");
   33 
   34     GpStatus status;
   35     GpBrushType brushType;
   36     GpWrapMode wrapMode;
   37     GpImage *brushImage;
   38     REAL brushWidth;
   39     REAL brushHeight;
   40     GpMatrix *brushTransform;
   41 
   42     GdipCreateMatrix (&brushTransform);
   43 
   44     status = GdipGetBrushType (brush, &brushType);
   45     assertEqualInt (brushType, BrushTypeTextureFill);
   46 
   47     status = GdipGetTextureWrapMode (brush, &wrapMode);
   48     assertEqualInt (status, Ok);
   49     assertEqualInt (wrapMode, expectedWrapMode);
   50 
   51     status = GdipGetTextureImage (brush, &brushImage);
   52     assertEqualInt (status, Ok);
   53 
   54     GdipGetImageDimension (brushImage, &brushWidth, &brushHeight);
   55     assertEqualFloat (brushWidth, expectedBrushWidth);
   56     assertEqualFloat (brushHeight, expectedBrushHeight);
   57 
   58     status = GdipGetTextureTransform (brush, brushTransform);
   59     assertEqualInt (status, Ok);
   60     verifyMatrix (brushTransform, 1, 0, 0, 1, 0, 0);
   61 
   62     GdipDisposeImage (brushImage);
   63     GdipDeleteMatrix (brushTransform);
   64 }
   65 
   66 static void test_clone ()
   67 {
   68     GpStatus status;
   69     GpTexture *brush;
   70     GpBrushType brushType;
   71     GpBrush *clone;
   72 
   73     GpImage *image1;
   74     GpImage *image2;
   75     REAL brushWidth;
   76     REAL brushHeight;
   77     GpWrapMode wrapMode;
   78 
   79     GdipLoadImageFromFile (bitmapFile, &image1);
   80 
   81     GdipCreateTexture (image1, WrapModeTile, &brush);
   82 
   83     status = GdipCloneBrush ((GpBrush *) brush, &clone);
   84     assertEqualInt (status, Ok);
   85     assert (clone && brush != clone);
   86 
   87     GdipGetBrushType (clone, &brushType);
   88     assertEqualInt (brushType, BrushTypeTextureFill);
   89 
   90     GdipGetTextureImage ((GpTexture *) clone, &image2);
   91 
   92     GdipGetImageDimension (image2, &brushWidth, &brushHeight);
   93     assertEqualFloat (brushWidth, 100);
   94     assertEqualFloat (brushHeight, 68);
   95 
   96     GdipGetTextureWrapMode ((GpTexture *) clone, &wrapMode);
   97     assertEqualInt (wrapMode, WrapModeTile);
   98 
   99     GdipDeleteBrush ((GpBrush *) brush);
  100     GdipDeleteBrush (clone);
  101     GdipDisposeImage (image1);
  102     GdipDisposeImage (image2);
  103 }
  104 
  105 static void test_delete ()
  106 {
  107     GpStatus status;
  108     GpTexture *brush;
  109     GpImage *image;
  110 
  111     GdipLoadImageFromFile (bitmapFile, &image);
  112     GdipCreateTexture (image, WrapModeTile, &brush);
  113 
  114     status = GdipDeleteBrush ((GpBrush *) brush);
  115     assertEqualInt (status, Ok);
  116 
  117     GdipDisposeImage (image);
  118 }
  119 
  120 static void test_createTexture ()
  121 {
  122     GpStatus status;
  123     GpImage *bitmapImage;
  124     GpImage *wmfImage;
  125     GpImage *emfImage;
  126     GpTexture *brush;
  127 
  128     GdipLoadImageFromFile (bitmapFile, &bitmapImage);
  129     GdipLoadImageFromFile (wmfFile, &wmfImage);
  130     GdipLoadImageFromFile (emfFile, &emfImage);
  131 
  132     // Bitmap image - WrapModeTile.
  133     status = GdipCreateTexture (bitmapImage, WrapModeTile, &brush);
  134     assertEqualInt (status, Ok);
  135     verifyTexture (brush, WrapModeTile, 100, 68);
  136     GdipDeleteBrush ((GpBrush *) brush);
  137 
  138     // Bitmap image - WrapModeTileFlipX.
  139     status = GdipCreateTexture (bitmapImage, WrapModeTileFlipX, &brush);
  140     assertEqualInt (status, Ok);
  141     verifyTexture (brush, WrapModeTileFlipX, 100, 68);
  142     GdipDeleteBrush ((GpBrush *) brush);
  143 
  144     // Bitmap image - WrapModeTileFlipY.
  145     status = GdipCreateTexture (bitmapImage, WrapModeTileFlipY, &brush);
  146     assertEqualInt (status, Ok);
  147     verifyTexture (brush, WrapModeTileFlipY, 100, 68);
  148     GdipDeleteBrush ((GpBrush *) brush);
  149 
  150     // Bitmap image - WrapModeTileFlipXY.
  151     status = GdipCreateTexture (bitmapImage, WrapModeTileFlipXY, &brush);
  152     assertEqualInt (status, Ok);
  153     verifyTexture (brush, WrapModeTileFlipXY, 100, 68);
  154     GdipDeleteBrush ((GpBrush *) brush);
  155 
  156     // Bitmap image - WrapModeClamp.
  157     status = GdipCreateTexture (bitmapImage, WrapModeClamp, &brush);
  158     assertEqualInt (status, Ok);
  159     verifyTexture (brush, WrapModeClamp, 100, 68);
  160     GdipDeleteBrush ((GpBrush *) brush);
  161 
  162     // Wmf image - WrapModeTile.
  163     status = GdipCreateTexture (wmfImage, WrapModeTile, &brush);
  164     assertEqualInt (status, Ok);
  165     verifyTexture (brush, WrapModeTile, 770, 649);
  166     GdipDeleteBrush ((GpBrush *) brush);
  167 
  168     // Wmf image - WrapModeTileFlipX.
  169     status = GdipCreateTexture (wmfImage, WrapModeTileFlipX, &brush);
  170     assertEqualInt (status, Ok);
  171     verifyTexture (brush, WrapModeTileFlipX, 770, 649);
  172     GdipDeleteBrush ((GpBrush *) brush);
  173 
  174     // Wmf image - WrapModeTileFlipY.
  175     status = GdipCreateTexture (wmfImage, WrapModeTileFlipY, &brush);
  176     assertEqualInt (status, Ok);
  177     verifyTexture (brush, WrapModeTileFlipY, 770, 649);
  178     GdipDeleteBrush ((GpBrush *) brush);
  179 
  180     // Wmf image - WrapModeTileFlipXY.
  181     status = GdipCreateTexture (wmfImage, WrapModeTileFlipXY, &brush);
  182     assertEqualInt (status, Ok);
  183     verifyTexture (brush, WrapModeTileFlipXY, 770, 649);
  184     GdipDeleteBrush ((GpBrush *) brush);
  185 
  186     // Wmf image - WrapModeClamp.
  187     status = GdipCreateTexture (wmfImage, WrapModeClamp, &brush);
  188     assertEqualInt (status, Ok);
  189     verifyTexture (brush, WrapModeClamp, 770, 649);
  190     GdipDeleteBrush ((GpBrush *) brush);
  191 
  192     // Emf image - WrapModeTile.
  193     status = GdipCreateTexture (emfImage, WrapModeTile, &brush);
  194     assertEqualInt (status, Ok);
  195     verifyTexture (brush, WrapModeTile, 100, 100);
  196     GdipDeleteBrush ((GpBrush *) brush);
  197 
  198     // Emf image - WrapModeTileFlipX.
  199     status = GdipCreateTexture (emfImage, WrapModeTileFlipX, &brush);
  200     assertEqualInt (status, Ok);
  201     verifyTexture (brush, WrapModeTileFlipX, 100, 100);
  202     GdipDeleteBrush ((GpBrush *) brush);
  203 
  204     // Emf image - WrapModeTileFlipY.
  205     status = GdipCreateTexture (emfImage, WrapModeTileFlipY, &brush);
  206     assertEqualInt (status, Ok);
  207     verifyTexture (brush, WrapModeTileFlipY, 100, 100);
  208     GdipDeleteBrush ((GpBrush *) brush);
  209 
  210     // Emf image - WrapModeTileFlipXY.
  211     status = GdipCreateTexture (emfImage, WrapModeTileFlipXY, &brush);
  212     assertEqualInt (status, Ok);
  213     verifyTexture (brush, WrapModeTileFlipXY, 100, 100);
  214     GdipDeleteBrush ((GpBrush *) brush);
  215 
  216     // Emf image - WrapModeClamp.
  217     status = GdipCreateTexture (emfImage, WrapModeClamp, &brush);
  218     assertEqualInt (status, Ok);
  219     verifyTexture (brush, WrapModeClamp, 100, 100);
  220     GdipDeleteBrush ((GpBrush *) brush);
  221 
  222     // Negative tests.
  223     brush = (GpTexture *) 0xCC;
  224     status = GdipCreateTexture (NULL, WrapModeClamp, &brush);
  225     assertEqualInt (status, InvalidParameter);
  226     assert (brush == (GpTexture *) 0xCC);
  227 
  228     brush = (GpTexture *) 0xCC;
  229     status = GdipCreateTexture (NULL, (GpWrapMode)(WrapModeClamp + 1), &brush);
  230     assertEqualInt (status, InvalidParameter);
  231     assert (brush == (GpTexture *) 0xCC);
  232 
  233     brush = (GpTexture *) 0xCC;
  234     status = GdipCreateTexture (bitmapImage, (GpWrapMode)(WrapModeClamp + 1), &brush);
  235     assertEqualInt (status, OutOfMemory);
  236     assert (brush == NULL);
  237 
  238     brush = (GpTexture *) 0xCC;
  239     status = GdipCreateTexture (wmfImage, (GpWrapMode)(WrapModeClamp + 1), &brush);
  240     assertEqualInt (status, OutOfMemory);
  241     assert (brush == NULL);
  242 
  243     brush = (GpTexture *) 0xCC;
  244     status = GdipCreateTexture (emfImage, (GpWrapMode)(WrapModeClamp + 1), &brush);
  245     assertEqualInt (status, OutOfMemory);
  246     assert (brush == NULL);
  247 
  248     brush = (GpTexture *) 0xCC;
  249     status = GdipCreateTexture (bitmapImage, WrapModeClamp, NULL);
  250     assertEqualInt (status, InvalidParameter);
  251     assert (brush == (GpTexture *) 0xCC);
  252 
  253     brush = (GpTexture *) 0xCC;
  254     status = GdipCreateTexture (wmfImage, WrapModeClamp, NULL);
  255     assertEqualInt (status, InvalidParameter);
  256     assert (brush == (GpTexture *) 0xCC);
  257 
  258     brush = (GpTexture *) 0xCC;
  259     status = GdipCreateTexture (emfImage, WrapModeClamp, NULL);
  260     assertEqualInt (status, InvalidParameter);
  261     assert (brush == (GpTexture *) 0xCC);
  262 
  263     GdipDisposeImage (bitmapImage);
  264     GdipDisposeImage (wmfImage);
  265     GdipDisposeImage (emfImage);
  266 }
  267 
  268 static void test_createTexture2 ()
  269 {
  270     GpStatus status;
  271     GpImage *bitmapImage;
  272     GpImage *wmfImage;
  273     GpImage *emfImage;
  274     GpTexture *brush;
  275 
  276     GdipLoadImageFromFile (bitmapFile, &bitmapImage);
  277     GdipLoadImageFromFile (wmfFile, &wmfImage);
  278     GdipLoadImageFromFile (emfFile, &emfImage);
  279 
  280     // Bitmap image - WrapModeTile.
  281     status = GdipCreateTexture2 (bitmapImage, WrapModeTile, 0, 0, 100, 68, &brush);
  282     assertEqualInt (status, Ok);
  283     verifyTexture (brush, WrapModeTile, 100, 68);
  284 
  285     GdipDeleteBrush ((GpBrush *) brush);
  286 
  287     // Bitmap image - WrapModeTileFlipX.
  288     status = GdipCreateTexture2 (bitmapImage, WrapModeTileFlipX, 0, 0, 100, 68, &brush);
  289     assertEqualInt (status, Ok);
  290     verifyTexture (brush, WrapModeTileFlipX, 100, 68);
  291 
  292     GdipDeleteBrush ((GpBrush *) brush);
  293 
  294     // Bitmap image - WrapModeTileFlipY.
  295     status = GdipCreateTexture2 (bitmapImage, WrapModeTileFlipY, 0, 0, 100, 68, &brush);
  296     assertEqualInt (status, Ok);
  297     verifyTexture (brush, WrapModeTileFlipY, 100, 68);
  298 
  299     GdipDeleteBrush ((GpBrush *) brush);
  300 
  301     // Bitmap image - WrapModeTileFlipXY.
  302     status = GdipCreateTexture2 (bitmapImage, WrapModeTileFlipXY, 0, 0, 100, 68, &brush);
  303     assertEqualInt (status, Ok);
  304     verifyTexture (brush, WrapModeTileFlipXY, 100, 68);
  305 
  306     GdipDeleteBrush ((GpBrush *) brush);
  307 
  308     // Bitmap image - clamp.
  309     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 5, 6, 7, 8, &brush);
  310     assertEqualInt (status, Ok);
  311     verifyTexture (brush, WrapModeClamp, 7, 8);
  312 
  313     GdipDeleteBrush ((GpBrush *) brush);
  314 
  315     // Wmf image - WrapModeTile, non zero.
  316     status = GdipCreateTexture2 (wmfImage, WrapModeTile, 0, 0, 2, 2, &brush);
  317     assertEqualInt (status, Ok);
  318     verifyTexture (brush, WrapModeTile, 2, 2);
  319 
  320     GdipDeleteBrush ((GpBrush *) brush);
  321 
  322     // Wmf image - WrapModeTileFlipX, non zero.
  323     status = GdipCreateTexture2 (wmfImage, WrapModeTileFlipX, 0, 0, 2, 2, &brush);
  324     assertEqualInt (status, Ok);
  325     verifyTexture (brush, WrapModeTileFlipX, 2, 2);
  326 
  327     GdipDeleteBrush ((GpBrush *) brush);
  328 
  329     // Wmf image - WrapModeTileFlipY, non zero.
  330     status = GdipCreateTexture2 (wmfImage, WrapModeTileFlipY, 0, 0, 2, 2, &brush);
  331     assertEqualInt (status, Ok);
  332     verifyTexture (brush, WrapModeTileFlipY, 2, 2);
  333 
  334     GdipDeleteBrush ((GpBrush *) brush);
  335 
  336     // Wmf image - WrapModeTileFlipXY, non zero.
  337     status = GdipCreateTexture2 (wmfImage, WrapModeTileFlipXY, 0, 0, 2, 2, &brush);
  338     assertEqualInt (status, Ok);
  339     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
  340 
  341     GdipDeleteBrush ((GpBrush *) brush);
  342 
  343     // Wmf image - clamp, non zero.
  344     status = GdipCreateTexture2 (wmfImage, WrapModeClamp, 1, 1, 2, 2, &brush);
  345     assertEqualInt (status, Ok);
  346     verifyTexture (brush, WrapModeClamp, 2, 2);
  347 
  348     GdipDeleteBrush ((GpBrush *) brush);
  349 
  350     // Wmf image - negative x and y.
  351     status = GdipCreateTexture2 (wmfImage, WrapModeClamp, -10, -10, 2, 2, &brush);
  352     assertEqualInt (status, Ok);
  353     verifyTexture (brush, WrapModeClamp, 2, 2);
  354 
  355     GdipDeleteBrush ((GpBrush *) brush);
  356 
  357     // Wmf image - large x and y.
  358     status = GdipCreateTexture2 (wmfImage, WrapModeClamp, 2000, 2000, 2, 2, &brush);
  359     assertEqualInt (status, Ok);
  360     verifyTexture (brush, WrapModeClamp, 2, 2);
  361 
  362     GdipDeleteBrush ((GpBrush *) brush);
  363 
  364     // Wmf image, zero width.
  365     status = GdipCreateTexture2 (wmfImage, WrapModeClamp, 1, 1, 0, 2, &brush);
  366     assertEqualInt (status, Ok);
  367     verifyTexture (brush, WrapModeClamp, 770, 649);
  368 
  369     GdipDeleteBrush ((GpBrush *) brush);
  370 
  371     // Wmf image, zero height.
  372     status = GdipCreateTexture2 (wmfImage, WrapModeClamp, 1, 1, 2, 0, &brush);
  373     assertEqualInt (status, Ok);
  374     verifyTexture (brush, WrapModeClamp, 770, 649);
  375 
  376     GdipDeleteBrush ((GpBrush *) brush);
  377 
  378     // Wmf image, negative width.
  379     status = GdipCreateTexture2 (wmfImage, WrapModeClamp, 1, 1, -1, 2, &brush);
  380     assertEqualInt (status, Ok);
  381     verifyTexture (brush, WrapModeClamp, 770, 649);
  382 
  383     GdipDeleteBrush ((GpBrush *) brush);
  384 
  385     // Wmf image, negative height.
  386     status = GdipCreateTexture2 (wmfImage, WrapModeClamp, 1, 1, 2, -1, &brush);
  387     assertEqualInt (status, Ok);
  388     verifyTexture (brush, WrapModeClamp, 770, 649);
  389 
  390     GdipDeleteBrush ((GpBrush *) brush);
  391 
  392     // Emf image - WrapModeTile, non zero.
  393     status = GdipCreateTexture2 (emfImage, WrapModeTile, 0, 0, 100, 100, &brush);
  394     assertEqualInt (status, Ok);
  395     verifyTexture (brush, WrapModeTile, 100, 100);
  396 
  397     GdipDeleteBrush ((GpBrush *) brush);
  398 
  399     // Emf image - WrapModeTileFlipX, non zero.
  400     status = GdipCreateTexture2 (emfImage, WrapModeTileFlipX, 0, 0, 100, 100, &brush);
  401     assertEqualInt (status, Ok);
  402     verifyTexture (brush, WrapModeTileFlipX, 100, 100);
  403 
  404     GdipDeleteBrush ((GpBrush *) brush);
  405 
  406     // Emf image - WrapModeTileFlipY, non zero.
  407     status = GdipCreateTexture2 (emfImage, WrapModeTileFlipY, 0, 0, 100, 100, &brush);
  408     assertEqualInt (status, Ok);
  409     verifyTexture (brush, WrapModeTileFlipY, 100, 100);
  410 
  411     GdipDeleteBrush ((GpBrush *) brush);
  412 
  413     // Emf image - WrapModeTileFlipXY, non zero.
  414     status = GdipCreateTexture2 (emfImage, WrapModeTileFlipXY, 0, 0, 100, 100, &brush);
  415     assertEqualInt (status, Ok);
  416     verifyTexture (brush, WrapModeTileFlipXY, 100, 100);
  417 
  418     GdipDeleteBrush ((GpBrush *) brush);
  419 
  420     // Emf image - WrapModeClamp, non zero.
  421     status = GdipCreateTexture2 (emfImage, WrapModeClamp, 1, 1, 50, 60, &brush);
  422     assertEqualInt (status, Ok);
  423     verifyTexture (brush, WrapModeClamp, 50, 60);
  424 
  425     GdipDeleteBrush ((GpBrush *) brush);
  426 
  427     // Emf image - negative x and y.
  428     status = GdipCreateTexture2 (emfImage, WrapModeClamp, -10, -10, 2, 2, &brush);
  429     assertEqualInt (status, Ok);
  430     verifyTexture (brush, WrapModeClamp, 2, 2);
  431 
  432     GdipDeleteBrush ((GpBrush *) brush);
  433 
  434     // Emf image - large x and y.
  435     status = GdipCreateTexture2 (emfImage, WrapModeClamp, 2000, 2000, 2, 2, &brush);
  436     assertEqualInt (status, Ok);
  437     verifyTexture (brush, WrapModeClamp, 2, 2);
  438 
  439     GdipDeleteBrush ((GpBrush *) brush);
  440 
  441     // Emf image, zero width.
  442     status = GdipCreateTexture2 (emfImage, WrapModeClamp, 1, 1, 0, 2, &brush);
  443     assertEqualInt (status, Ok);
  444     verifyTexture (brush, WrapModeClamp, 100, 100);
  445 
  446     GdipDeleteBrush ((GpBrush *) brush);
  447 
  448     // Emf image, zero height.
  449     status = GdipCreateTexture2 (emfImage, WrapModeClamp, 1, 1, 2, 0, &brush);
  450     assertEqualInt (status, Ok);
  451     verifyTexture (brush, WrapModeClamp, 100, 100);
  452 
  453     GdipDeleteBrush ((GpBrush *) brush);
  454 
  455     // Emf image, negative width.
  456     status = GdipCreateTexture2 (emfImage, WrapModeClamp, 1, 1, -1, 2, &brush);
  457     assertEqualInt (status, Ok);
  458     verifyTexture (brush, WrapModeClamp, 100, 100);
  459 
  460     GdipDeleteBrush ((GpBrush *) brush);
  461 
  462     // Emf image, negative height.
  463     status = GdipCreateTexture2 (emfImage, WrapModeClamp, 1, 1, 2, -1, &brush);
  464     assertEqualInt (status, Ok);
  465     verifyTexture (brush, WrapModeClamp, 100, 100);
  466 
  467     GdipDeleteBrush ((GpBrush *) brush);
  468 
  469     // Negative tests.
  470     brush = (GpTexture *) 0xCC;
  471     status = GdipCreateTexture2 (NULL, WrapModeClamp, 0, 0, 1, 2, &brush);
  472     assertEqualInt (status, InvalidParameter);
  473     assert (brush == (GpTexture *) 0xCC);
  474 
  475     brush = (GpTexture *) 0xCC;
  476     status = GdipCreateTexture2 (NULL, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  477     assertEqualInt (status, InvalidParameter);
  478     assert (brush == (GpTexture *) 0xCC);
  479 
  480     brush = (GpTexture *) 0xCC;
  481     status = GdipCreateTexture2 (NULL, WrapModeClamp, 0, 0, 0, 2, &brush);
  482     assertEqualInt (status, InvalidParameter);
  483     assert (brush == (GpTexture *) 0xCC);
  484 
  485     brush = (GpTexture *) 0xCC;
  486     status = GdipCreateTexture2 (NULL, WrapModeClamp, 0, 0, -1, 2, &brush);
  487     assertEqualInt (status, InvalidParameter);
  488     assert (brush == (GpTexture *) 0xCC);
  489 
  490     brush = (GpTexture *) 0xCC;
  491     status = GdipCreateTexture2 (NULL, WrapModeClamp, 0, 0, 1, 0, &brush);
  492     assertEqualInt (status, InvalidParameter);
  493     assert (brush == (GpTexture *) 0xCC);
  494 
  495     brush = (GpTexture *) 0xCC;
  496     status = GdipCreateTexture2 (NULL, WrapModeClamp, 0, 0, 1, -1, &brush);
  497     assertEqualInt (status, InvalidParameter);
  498     assert (brush == (GpTexture *) 0xCC);
  499 
  500     brush = (GpTexture *) 0xCC;
  501     status = GdipCreateTexture2 (bitmapImage, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  502     assertEqualInt (status, OutOfMemory);
  503     assert (brush == NULL);
  504 
  505     brush = (GpTexture *) 0xCC;
  506     status = GdipCreateTexture2 (wmfImage, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  507     assertEqualInt (status, OutOfMemory);
  508     assert (brush == NULL);
  509 
  510     brush = (GpTexture *) 0xCC;
  511     status = GdipCreateTexture2 (emfImage, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  512     assertEqualInt (status, OutOfMemory);
  513     assert (brush == NULL);
  514 
  515     brush = (GpTexture *) 0xCC;
  516     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, -1, 0, 1, 2, &brush);
  517     assertEqualInt (status, OutOfMemory);
  518     assert (brush == NULL);
  519 
  520     brush = (GpTexture *) 0xCC;
  521     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, -1, 1, 2, &brush);
  522     assertEqualInt (status, OutOfMemory);
  523     assert (brush == NULL);
  524 
  525     brush = (GpTexture *) 0xCC;
  526     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, -1, 2, &brush);
  527     assertEqualInt (status, OutOfMemory);
  528     assert (brush == NULL);
  529 
  530     brush = (GpTexture *) 0xCC;
  531     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 0, 2, &brush);
  532     assertEqualInt (status, OutOfMemory);
  533     assert (brush == NULL);
  534 
  535     brush = (GpTexture *) 0xCC;
  536     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 1, 0, &brush);
  537     assertEqualInt (status, OutOfMemory);
  538     assert (brush == NULL);
  539 
  540     brush = (GpTexture *) 0xCC;
  541     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 1, -1, &brush);
  542     assertEqualInt (status, OutOfMemory);
  543     assert (brush == NULL);
  544 
  545     brush = (GpTexture *) 0xCC;
  546     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 101, 2, &brush);
  547     assertEqualInt (status, OutOfMemory);
  548     assert (brush == NULL);
  549 
  550     brush = (GpTexture *) 0xCC;
  551     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 1, 0, 100, 2, &brush);
  552     assertEqualInt (status, OutOfMemory);
  553     assert (brush == NULL);
  554 
  555     brush = (GpTexture *) 0xCC;
  556     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 100, 69, &brush);
  557     assertEqualInt (status, OutOfMemory);
  558     assert (brush == NULL);
  559 
  560     brush = (GpTexture *) 0xCC;
  561     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 1, 100, 68, &brush);
  562     assertEqualInt (status, OutOfMemory);
  563     assert (brush == NULL);
  564 
  565     brush = (GpTexture *) 0xCC;
  566     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 1, 2, NULL);
  567     assertEqualInt (status, InvalidParameter);
  568     assert (brush == (GpTexture *) 0xCC);
  569 
  570     brush = (GpTexture *) 0xCC;
  571     status = GdipCreateTexture2 (bitmapImage, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, NULL);
  572     assertEqualInt (status, InvalidParameter);
  573     assert (brush == (GpTexture *) 0xCC);
  574 
  575     brush = (GpTexture *) 0xCC;
  576     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 0, 2, NULL);
  577     assertEqualInt (status, InvalidParameter);
  578     assert (brush == (GpTexture *) 0xCC);
  579 
  580     brush = (GpTexture *) 0xCC;
  581     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, -1, 2, NULL);
  582     assertEqualInt (status, InvalidParameter);
  583     assert (brush == (GpTexture *) 0xCC);
  584 
  585     brush = (GpTexture *) 0xCC;
  586     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 1, 0, NULL);
  587     assertEqualInt (status, InvalidParameter);
  588     assert (brush == (GpTexture *) 0xCC);
  589 
  590     brush = (GpTexture *) 0xCC;
  591     status = GdipCreateTexture2 (bitmapImage, WrapModeClamp, 0, 0, 1, -1, NULL);
  592     assertEqualInt (status, InvalidParameter);
  593     assert (brush == (GpTexture *) 0xCC);
  594 
  595     GdipDisposeImage (bitmapImage);
  596     GdipDisposeImage (wmfImage);
  597     GdipDisposeImage (emfImage);
  598 }
  599 
  600 static void test_createTexture2I ()
  601 {
  602     GpStatus status;
  603     GpImage *bitmapImage;
  604     GpImage *wmfImage;
  605     GpImage *emfImage;
  606     GpTexture *brush;
  607 
  608     GdipLoadImageFromFile (bitmapFile, &bitmapImage);
  609     GdipLoadImageFromFile (wmfFile, &wmfImage);
  610     GdipLoadImageFromFile (emfFile, &emfImage);
  611 
  612     // Bitmap image - WrapModeTile.
  613     status = GdipCreateTexture2I (bitmapImage, WrapModeTile, 0, 0, 100, 68, &brush);
  614     assertEqualInt (status, Ok);
  615     verifyTexture (brush, WrapModeTile, 100, 68);
  616 
  617     GdipDeleteBrush ((GpBrush *) brush);
  618 
  619     // Bitmap image - WrapModeTileFlipX.
  620     status = GdipCreateTexture2I (bitmapImage, WrapModeTileFlipX, 0, 0, 100, 68, &brush);
  621     assertEqualInt (status, Ok);
  622     verifyTexture (brush, WrapModeTileFlipX, 100, 68);
  623 
  624     GdipDeleteBrush ((GpBrush *) brush);
  625 
  626     // Bitmap image - WrapModeTileFlipXY.
  627     status = GdipCreateTexture2I (bitmapImage, WrapModeTileFlipXY, 0, 0, 100, 68, &brush);
  628     assertEqualInt (status, Ok);
  629     verifyTexture (brush, WrapModeTileFlipXY, 100, 68);
  630 
  631     GdipDeleteBrush ((GpBrush *) brush);
  632 
  633     // Bitmap image - WrapModeTileFlipY.
  634     status = GdipCreateTexture2I (bitmapImage, WrapModeTileFlipY, 0, 0, 100, 68, &brush);
  635     assertEqualInt (status, Ok);
  636     verifyTexture (brush, WrapModeTileFlipY, 100, 68);
  637 
  638     GdipDeleteBrush ((GpBrush *) brush);
  639 
  640     // Bitmap image - clamp.
  641     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 5, 6, 7, 8, &brush);
  642     assertEqualInt (status, Ok);
  643     verifyTexture (brush, WrapModeClamp, 7, 8);
  644 
  645     GdipDeleteBrush ((GpBrush *) brush);
  646 
  647     // Wmf image - WrapModeTile, non zero.
  648     status = GdipCreateTexture2I (wmfImage, WrapModeTile, 0, 0, 2, 2, &brush);
  649     assertEqualInt (status, Ok);
  650     verifyTexture (brush, WrapModeTile, 2, 2);
  651 
  652     GdipDeleteBrush ((GpBrush *) brush);
  653 
  654     // Wmf image - WrapModeTileFlipX, non zero.
  655     status = GdipCreateTexture2I (wmfImage, WrapModeTileFlipX, 0, 0, 2, 2, &brush);
  656     assertEqualInt (status, Ok);
  657     verifyTexture (brush, WrapModeTileFlipX, 2, 2);
  658 
  659     GdipDeleteBrush ((GpBrush *) brush);
  660 
  661     // Wmf image - WrapModeTileFlipY, non zero.
  662     status = GdipCreateTexture2I (wmfImage, WrapModeTileFlipY, 0, 0, 2, 2, &brush);
  663     assertEqualInt (status, Ok);
  664     verifyTexture (brush, WrapModeTileFlipY, 2, 2);
  665 
  666     GdipDeleteBrush ((GpBrush *) brush);
  667 
  668     // Wmf image - WrapModeTileFlipXY, non zero.
  669     status = GdipCreateTexture2I (wmfImage, WrapModeTileFlipXY, 0, 0, 2, 2, &brush);
  670     assertEqualInt (status, Ok);
  671     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
  672 
  673     GdipDeleteBrush ((GpBrush *) brush);
  674 
  675     // Wmf image - clamp, non zero.
  676     status = GdipCreateTexture2I (wmfImage, WrapModeClamp, 1, 1, 2, 2, &brush);
  677     assertEqualInt (status, Ok);
  678     verifyTexture (brush, WrapModeClamp, 2, 2);
  679 
  680     GdipDeleteBrush ((GpBrush *) brush);
  681 
  682     // Wmf image - negative x and y.
  683     status = GdipCreateTexture2I (wmfImage, WrapModeClamp, -10, -10, 2, 2, &brush);
  684     assertEqualInt (status, Ok);
  685     verifyTexture (brush, WrapModeClamp, 2, 2);
  686 
  687     GdipDeleteBrush ((GpBrush *) brush);
  688 
  689     // Wmf image - large x and y.
  690     status = GdipCreateTexture2I (wmfImage, WrapModeClamp, 2000, 2000, 2, 2, &brush);
  691     assertEqualInt (status, Ok);
  692     verifyTexture (brush, WrapModeClamp, 2, 2);
  693 
  694     GdipDeleteBrush ((GpBrush *) brush);
  695 
  696     // Wmf image, zero width.
  697     status = GdipCreateTexture2I (wmfImage, WrapModeClamp, 1, 1, 0, 2, &brush);
  698     assertEqualInt (status, Ok);
  699     verifyTexture (brush, WrapModeClamp, 770, 649);
  700 
  701     GdipDeleteBrush ((GpBrush *) brush);
  702 
  703     // Wmf image, zero height.
  704     status = GdipCreateTexture2I (wmfImage, WrapModeClamp, 1, 1, 2, 0, &brush);
  705     assertEqualInt (status, Ok);
  706     verifyTexture (brush, WrapModeClamp, 770, 649);
  707 
  708     GdipDeleteBrush ((GpBrush *) brush);
  709 
  710     // Wmf image, negative width.
  711     status = GdipCreateTexture2I (wmfImage, WrapModeClamp, 1, 1, -1, 2, &brush);
  712     assertEqualInt (status, Ok);
  713     verifyTexture (brush, WrapModeClamp, 770, 649);
  714 
  715     GdipDeleteBrush ((GpBrush *) brush);
  716 
  717     // Wmf image, negative height.
  718     status = GdipCreateTexture2I (wmfImage, WrapModeClamp, 1, 1, 2, -1, &brush);
  719     assertEqualInt (status, Ok);
  720     verifyTexture (brush, WrapModeClamp, 770, 649);
  721 
  722     GdipDeleteBrush ((GpBrush *) brush);
  723 
  724     // Emf image - WrapModeTile, non zero.
  725     status = GdipCreateTexture2I (emfImage, WrapModeTile, 0, 0, 100, 100, &brush);
  726     assertEqualInt (status, Ok);
  727     verifyTexture (brush, WrapModeTile, 100, 100);
  728 
  729     GdipDeleteBrush ((GpBrush *) brush);
  730 
  731     // Emf image - WrapModeTileFlipX, non zero.
  732     status = GdipCreateTexture2I (emfImage, WrapModeTileFlipX, 0, 0, 100, 100, &brush);
  733     assertEqualInt (status, Ok);
  734     verifyTexture (brush, WrapModeTileFlipX, 100, 100);
  735 
  736     GdipDeleteBrush ((GpBrush *) brush);
  737 
  738     // Emf image - WrapModeTileFlipY, non zero.
  739     status = GdipCreateTexture2I (emfImage, WrapModeTileFlipY, 0, 0, 100, 100, &brush);
  740     assertEqualInt (status, Ok);
  741     verifyTexture (brush, WrapModeTileFlipY, 100, 100);
  742 
  743     GdipDeleteBrush ((GpBrush *) brush);
  744 
  745     // Emf image - WrapModeTileFlipXY, non zero.
  746     status = GdipCreateTexture2I (emfImage, WrapModeTileFlipXY, 0, 0, 100, 100, &brush);
  747     assertEqualInt (status, Ok);
  748     verifyTexture (brush, WrapModeTileFlipXY, 100, 100);
  749 
  750     GdipDeleteBrush ((GpBrush *) brush);
  751 
  752     // Emf image - tile, non zero.
  753     status = GdipCreateTexture2I (emfImage, WrapModeTile, 0, 0, 100, 100, &brush);
  754     assertEqualInt (status, Ok);
  755     verifyTexture (brush, WrapModeTile, 100, 100);
  756 
  757     GdipDeleteBrush ((GpBrush *) brush);
  758 
  759     // Emf image - WrapModeClamp, non zero.
  760     status = GdipCreateTexture2I (emfImage, WrapModeClamp, 1, 1, 50, 60, &brush);
  761     assertEqualInt (status, Ok);
  762     verifyTexture (brush, WrapModeClamp, 50, 60);
  763 
  764     GdipDeleteBrush ((GpBrush *) brush);
  765 
  766     // Emf image - negative x and y.
  767     status = GdipCreateTexture2I (emfImage, WrapModeClamp, -10, -10, 2, 2, &brush);
  768     assertEqualInt (status, Ok);
  769     verifyTexture (brush, WrapModeClamp, 2, 2);
  770 
  771     GdipDeleteBrush ((GpBrush *) brush);
  772 
  773     // Emf image - large x and y.
  774     status = GdipCreateTexture2I (emfImage, WrapModeClamp, 2000, 2000, 2, 2, &brush);
  775     assertEqualInt (status, Ok);
  776     verifyTexture (brush, WrapModeClamp, 2, 2);
  777 
  778     GdipDeleteBrush ((GpBrush *) brush);
  779 
  780     // Emf image, zero width.
  781     status = GdipCreateTexture2I (emfImage, WrapModeClamp, 1, 1, 0, 2, &brush);
  782     assertEqualInt (status, Ok);
  783     verifyTexture (brush, WrapModeClamp, 100, 100);
  784 
  785     GdipDeleteBrush ((GpBrush *) brush);
  786 
  787     // Emf image, zero height.
  788     status = GdipCreateTexture2I (emfImage, WrapModeClamp, 1, 1, 2, 0, &brush);
  789     assertEqualInt (status, Ok);
  790     verifyTexture (brush, WrapModeClamp, 100, 100);
  791 
  792     GdipDeleteBrush ((GpBrush *) brush);
  793 
  794     // Emf image, negative width.
  795     status = GdipCreateTexture2I (emfImage, WrapModeClamp, 1, 1, -1, 2, &brush);
  796     assertEqualInt (status, Ok);
  797     verifyTexture (brush, WrapModeClamp, 100, 100);
  798 
  799     GdipDeleteBrush ((GpBrush *) brush);
  800 
  801     // Emf image, negative height.
  802     status = GdipCreateTexture2I (emfImage, WrapModeClamp, 1, 1, 2, -1, &brush);
  803     assertEqualInt (status, Ok);
  804     verifyTexture (brush, WrapModeClamp, 100, 100);
  805 
  806     GdipDeleteBrush ((GpBrush *) brush);
  807 
  808     // Negative tests.
  809     brush = (GpTexture *) 0xCC;
  810     status = GdipCreateTexture2I (NULL, WrapModeClamp, 0, 0, 1, 2, &brush);
  811     assertEqualInt (status, InvalidParameter);
  812     assert (brush == (GpTexture *) 0xCC);
  813 
  814     brush = (GpTexture *) 0xCC;
  815     status = GdipCreateTexture2I (NULL, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  816     assertEqualInt (status, InvalidParameter);
  817     assert (brush == (GpTexture *) 0xCC);
  818 
  819     brush = (GpTexture *) 0xCC;
  820     status = GdipCreateTexture2I (NULL, WrapModeClamp, 0, 0, 0, 2, &brush);
  821     assertEqualInt (status, InvalidParameter);
  822     assert (brush == (GpTexture *) 0xCC);
  823 
  824     brush = (GpTexture *) 0xCC;
  825     status = GdipCreateTexture2I (NULL, WrapModeClamp, 0, 0, -1, 2, &brush);
  826     assertEqualInt (status, InvalidParameter);
  827     assert (brush == (GpTexture *) 0xCC);
  828 
  829     brush = (GpTexture *) 0xCC;
  830     status = GdipCreateTexture2I (NULL, WrapModeClamp, 0, 0, 1, 0, &brush);
  831     assertEqualInt (status, InvalidParameter);
  832     assert (brush == (GpTexture *) 0xCC);
  833 
  834     brush = (GpTexture *) 0xCC;
  835     status = GdipCreateTexture2I (NULL, WrapModeClamp, 0, 0, 1, -1, &brush);
  836     assertEqualInt (status, InvalidParameter);
  837     assert (brush == (GpTexture *) 0xCC);
  838 
  839     brush = (GpTexture *) 0xCC;
  840     status = GdipCreateTexture2I (bitmapImage, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  841     assertEqualInt (status, OutOfMemory);
  842     assert (brush == NULL);
  843 
  844     brush = (GpTexture *) 0xCC;
  845     status = GdipCreateTexture2I (wmfImage, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  846     assertEqualInt (status, OutOfMemory);
  847     assert (brush == NULL);
  848 
  849     brush = (GpTexture *) 0xCC;
  850     status = GdipCreateTexture2I (emfImage, (WrapMode)(WrapModeClamp + 1), 0, 0, 1, 2, &brush);
  851     assertEqualInt (status, OutOfMemory);
  852     assert (brush == NULL);
  853 
  854     brush = (GpTexture *) 0xCC;
  855     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, -1, 0, 1, 2, &brush);
  856     assertEqualInt (status, OutOfMemory);
  857     assert (brush == NULL);
  858 
  859     brush = (GpTexture *) 0xCC;
  860     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, -1, 1, 2, &brush);
  861     assertEqualInt (status, OutOfMemory);
  862     assert (brush == NULL);
  863 
  864     brush = (GpTexture *) 0xCC;
  865     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 0, -1, 2, &brush);
  866     assertEqualInt (status, OutOfMemory);
  867     assert (brush == NULL);
  868 
  869     brush = (GpTexture *) 0xCC;
  870     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 0, 0, 2, &brush);
  871     assertEqualInt (status, OutOfMemory);
  872     assert (brush == NULL);
  873 
  874     brush = (GpTexture *) 0xCC;
  875     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 0, 1, 0, &brush);
  876     assertEqualInt (status, OutOfMemory);
  877     assert (brush == NULL);
  878 
  879     brush = (GpTexture *) 0xCC;
  880     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 0, 1, -1, &brush);
  881     assertEqualInt (status, OutOfMemory);
  882     assert (brush == NULL);
  883 
  884     brush = (GpTexture *) 0xCC;
  885     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 0, 101, 2, &brush);
  886     assertEqualInt (status, OutOfMemory);
  887     assert (brush == NULL);
  888 
  889     brush = (GpTexture *) 0xCC;
  890     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 1, 0, 100, 2, &brush);
  891     assertEqualInt (status, OutOfMemory);
  892     assert (brush == NULL);
  893 
  894     brush = (GpTexture *) 0xCC;
  895     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 0, 100, 69, &brush);
  896     assertEqualInt (status, OutOfMemory);
  897     assert (brush == NULL);
  898 
  899     brush = (GpTexture *) 0xCC;
  900     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 1, 100, 68, &brush);
  901     assertEqualInt (status, OutOfMemory);
  902     assert (brush == NULL);
  903 
  904     brush = (GpTexture *) 0xCC;
  905     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 1, 100, 68, NULL);
  906     assertEqualInt (status, InvalidParameter);
  907     assert (brush == (GpTexture *) 0xCC);
  908 
  909     brush = (GpTexture *) 0xCC;
  910     status = GdipCreateTexture2I (bitmapImage, (WrapMode)(WrapModeClamp + 1), 0, 1, 100, 68, NULL);
  911     assertEqualInt (status, InvalidParameter);
  912     assert (brush == (GpTexture *) 0xCC);
  913 
  914     brush = (GpTexture *) 0xCC;
  915     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 1, 0, 68, NULL);
  916     assertEqualInt (status, InvalidParameter);
  917     assert (brush == (GpTexture *) 0xCC);
  918 
  919     brush = (GpTexture *) 0xCC;
  920     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 1, -1, 68, NULL);
  921     assertEqualInt (status, InvalidParameter);
  922     assert (brush == (GpTexture *) 0xCC);
  923 
  924     brush = (GpTexture *) 0xCC;
  925     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 1, 100, 0, NULL);
  926     assertEqualInt (status, InvalidParameter);
  927     assert (brush == (GpTexture *) 0xCC);
  928 
  929     brush = (GpTexture *) 0xCC;
  930     status = GdipCreateTexture2I (bitmapImage, WrapModeClamp, 0, 1, 100, -1, NULL);
  931     assertEqualInt (status, InvalidParameter);
  932     assert (brush == (GpTexture *) 0xCC);
  933 
  934     GdipDisposeImage (bitmapImage);
  935     GdipDisposeImage (wmfImage);
  936     GdipDisposeImage (emfImage);
  937 }
  938 
  939 static void test_createTextureIA ()
  940 {
  941     GpStatus status;
  942     GpImage *bitmapImage;
  943     GpImage *wmfImage;
  944     GpImage *emfImage;
  945     GpImageAttributes *attributes;
  946     GpImageAttributes *customAttributes;
  947     GpImageAttributes *customAttributesClamp;
  948     GpImageAttributes *customAttributesInvalidWrap;
  949     GpTexture *brush;
  950 
  951     GdipLoadImageFromFile (bitmapFile, &bitmapImage);
  952     GdipLoadImageFromFile (wmfFile, &wmfImage);
  953     GdipLoadImageFromFile (emfFile, &emfImage);
  954     GdipCreateImageAttributes (&attributes);
  955     GdipCreateImageAttributes (&customAttributes);
  956     GdipCreateImageAttributes (&customAttributesClamp);
  957     GdipCreateImageAttributes (&customAttributesInvalidWrap);
  958     GdipSetImageAttributesWrapMode (customAttributes, WrapModeTileFlipXY, 0xFF00FF00, FALSE);
  959     GdipSetImageAttributesWrapMode (customAttributesClamp, WrapModeTileFlipXY, 0xFF00FF00, TRUE);
  960     GdipSetImageAttributesWrapMode (customAttributesInvalidWrap, (WrapMode)(WrapModeClamp + 1), 0xFF00FF00, TRUE);
  961 
  962     // Bitmap image - full size.
  963     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, 100, 68, &brush);
  964     assertEqualInt (status, Ok);
  965     verifyTexture (brush, WrapModeTile, 100, 68);
  966 
  967     GdipDeleteBrush ((GpBrush *) brush);
  968 
  969     // Bitmap image - custom size.
  970     status = GdipCreateTextureIA (bitmapImage, NULL, 5, 6, 7, 8, &brush);
  971     assertEqualInt (status, Ok);
  972     verifyTexture (brush, WrapModeTile, 7, 8);
  973 
  974     GdipDeleteBrush ((GpBrush *) brush);
  975 
  976     // Bitmap image - attributes with default wrap mode.
  977     status = GdipCreateTextureIA (bitmapImage, attributes, 0, 0, 2, 2, &brush);
  978     assertEqualInt (status, Ok);
  979     verifyTexture (brush, WrapModeClamp, 2, 2);
  980 
  981     GdipDeleteBrush ((GpBrush *) brush);
  982 
  983     // Bitmap image - attributes with custom wrap mode.
  984     status = GdipCreateTextureIA (bitmapImage, customAttributes, 0, 0, 2, 2, &brush);
  985     assertEqualInt (status, Ok);
  986     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
  987 
  988     GdipDeleteBrush ((GpBrush *) brush);
  989 
  990     // Bitmap image - attributes with custom wrap mode and clamp.
  991     status = GdipCreateTextureIA (bitmapImage, customAttributesClamp, 0, 0, 2, 2, &brush);
  992     assertEqualInt (status, Ok);
  993     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
  994 
  995     GdipDeleteBrush ((GpBrush *) brush);
  996 
  997     // Wmf image - full.
  998     status = GdipCreateTextureIA (wmfImage, NULL, 0, 0, 2, 2, &brush);
  999     assertEqualInt (status, Ok);
 1000     verifyTexture (brush, WrapModeTile, 2, 2);
 1001 
 1002     GdipDeleteBrush ((GpBrush *) brush);
 1003 
 1004     // Wmf image - small size.
 1005     status = GdipCreateTextureIA (wmfImage, NULL, 1, 1, 2, 2, &brush);
 1006     assertEqualInt (status, Ok);
 1007     verifyTexture (brush, WrapModeTile, 2, 2);
 1008 
 1009     GdipDeleteBrush ((GpBrush *) brush);
 1010 
 1011     // Wmf image - negative x and y.
 1012     status = GdipCreateTextureIA (wmfImage, NULL, -10, -10, 2, 2, &brush);
 1013     assertEqualInt (status, Ok);
 1014     verifyTexture (brush, WrapModeTile, 2, 2);
 1015 
 1016     GdipDeleteBrush ((GpBrush *) brush);
 1017 
 1018     // Wmf image - large x and y.
 1019     status = GdipCreateTextureIA (wmfImage, NULL, 2000, 2000, 2, 2, &brush);
 1020     assertEqualInt (status, Ok);
 1021     verifyTexture (brush, WrapModeTile, 2, 2);
 1022 
 1023     GdipDeleteBrush ((GpBrush *) brush);
 1024 
 1025     // Wmf image, zero width.
 1026     status = GdipCreateTextureIA (wmfImage, NULL, 1, 1, 0, 2, &brush);
 1027     assertEqualInt (status, Ok);
 1028     verifyTexture (brush, WrapModeTile, 770, 649);
 1029 
 1030     GdipDeleteBrush ((GpBrush *) brush);
 1031 
 1032     // Wmf image, zero height.
 1033     status = GdipCreateTextureIA (wmfImage, NULL, 1, 1, 2, 0, &brush);
 1034     assertEqualInt (status, Ok);
 1035     verifyTexture (brush, WrapModeTile, 770, 649);
 1036 
 1037     GdipDeleteBrush ((GpBrush *) brush);
 1038 
 1039     // Wmf image, negative width.
 1040     status = GdipCreateTextureIA (wmfImage, NULL, 1, 1, -1, 2, &brush);
 1041     assertEqualInt (status, Ok);
 1042     verifyTexture (brush, WrapModeTile, 770, 649);
 1043 
 1044     GdipDeleteBrush ((GpBrush *) brush);
 1045 
 1046     // Wmf image, negative height.
 1047     status = GdipCreateTextureIA (wmfImage, NULL, 1, 1, 2, -1, &brush);
 1048     assertEqualInt (status, Ok);
 1049     verifyTexture (brush, WrapModeTile, 770, 649);
 1050 
 1051     GdipDeleteBrush ((GpBrush *) brush);
 1052 
 1053     // Wmf image - attributes with default wrap mode.
 1054     status = GdipCreateTextureIA (wmfImage, attributes, 0, 0, 2, 2, &brush);
 1055     assertEqualInt (status, Ok);
 1056     verifyTexture (brush, WrapModeClamp, 2, 2);
 1057 
 1058     GdipDeleteBrush ((GpBrush *) brush);
 1059 
 1060     // Wmf image - attributes with custom wrap mode.
 1061     status = GdipCreateTextureIA (wmfImage, customAttributes, 0, 0, 2, 2, &brush);
 1062     assertEqualInt (status, Ok);
 1063     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1064 
 1065     GdipDeleteBrush ((GpBrush *) brush);
 1066 
 1067     // Wmf image - attributes with custom wrap mode and clamp.
 1068     status = GdipCreateTextureIA (wmfImage, customAttributesClamp, 0, 0, 2, 2, &brush);
 1069     assertEqualInt (status, Ok);
 1070     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1071 
 1072     GdipDeleteBrush ((GpBrush *) brush);
 1073 
 1074     // Emf image - non zero.
 1075     status = GdipCreateTextureIA (emfImage, NULL, 0, 0, 100, 100, &brush);
 1076     assertEqualInt (status, Ok);
 1077     verifyTexture (brush, WrapModeTile, 100, 100);
 1078 
 1079     GdipDeleteBrush ((GpBrush *) brush);
 1080 
 1081     // Emf image - non zero.
 1082     status = GdipCreateTextureIA (emfImage, NULL, 1, 1, 50, 60, &brush);
 1083     assertEqualInt (status, Ok);
 1084     verifyTexture (brush, WrapModeTile, 50, 60);
 1085 
 1086     GdipDeleteBrush ((GpBrush *) brush);
 1087 
 1088     // Emf image - negative x and y.
 1089     status = GdipCreateTextureIA (emfImage, NULL, -10, -10, 2, 2, &brush);
 1090     assertEqualInt (status, Ok);
 1091     verifyTexture (brush, WrapModeTile, 2, 2);
 1092 
 1093     GdipDeleteBrush ((GpBrush *) brush);
 1094 
 1095     // Emf image - large x and y.
 1096     status = GdipCreateTextureIA (emfImage, NULL, 2000, 2000, 2, 2, &brush);
 1097     assertEqualInt (status, Ok);
 1098     verifyTexture (brush, WrapModeTile, 2, 2);
 1099 
 1100     GdipDeleteBrush ((GpBrush *) brush);
 1101 
 1102     // Emf image, zero width.
 1103     status = GdipCreateTextureIA (emfImage, NULL, 1, 1, 0, 2, &brush);
 1104     assertEqualInt (status, Ok);
 1105     verifyTexture (brush, WrapModeTile, 100, 100);
 1106 
 1107     GdipDeleteBrush ((GpBrush *) brush);
 1108 
 1109     // Emf image, zero height.
 1110     status = GdipCreateTextureIA (emfImage, NULL, 1, 1, 2, 0, &brush);
 1111     assertEqualInt (status, Ok);
 1112     verifyTexture (brush, WrapModeTile, 100, 100);
 1113 
 1114     GdipDeleteBrush ((GpBrush *) brush);
 1115 
 1116     // Emf image, negative width.
 1117     status = GdipCreateTextureIA (emfImage, NULL, 1, 1, -1, 2, &brush);
 1118     assertEqualInt (status, Ok);
 1119     verifyTexture (brush, WrapModeTile, 100, 100);
 1120 
 1121     GdipDeleteBrush ((GpBrush *) brush);
 1122 
 1123     // Emf image, negative height.
 1124     status = GdipCreateTextureIA (emfImage, NULL, 1, 1, 2, -1, &brush);
 1125     assertEqualInt (status, Ok);
 1126     verifyTexture (brush, WrapModeTile, 100, 100);
 1127 
 1128     GdipDeleteBrush ((GpBrush *) brush);
 1129 
 1130     // Emf image - attributes with default wrap mode.
 1131     status = GdipCreateTextureIA (emfImage, attributes, 0, 0, 2, 2, &brush);
 1132     assertEqualInt (status, Ok);
 1133     verifyTexture (brush, WrapModeClamp, 2, 2);
 1134 
 1135     GdipDeleteBrush ((GpBrush *) brush);
 1136 
 1137     // Emf image - attributes with custom wrap mode.
 1138     status = GdipCreateTextureIA (emfImage, customAttributes, 0, 0, 2, 2, &brush);
 1139     assertEqualInt (status, Ok);
 1140     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1141 
 1142     GdipDeleteBrush ((GpBrush *) brush);
 1143 
 1144     // Emf image - attributes with custom wrap mode and clamp.
 1145     status = GdipCreateTextureIA (emfImage, customAttributesClamp, 0, 0, 2, 2, &brush);
 1146     assertEqualInt (status, Ok);
 1147     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1148 
 1149     GdipDeleteBrush ((GpBrush *) brush);
 1150 
 1151     // Negative tests.
 1152     brush = (GpTexture *) 0xCC;
 1153     status = GdipCreateTextureIA (NULL, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1154     assertEqualInt (status, InvalidParameter);
 1155     assert (brush == (GpTexture *) 0xCC);
 1156 
 1157     brush = (GpTexture *) 0xCC;
 1158     status = GdipCreateTextureIA (NULL, NULL, 0, 0, 1, 2, &brush);
 1159     assertEqualInt (status, InvalidParameter);
 1160     assert (brush == (GpTexture *) 0xCC);
 1161 
 1162     brush = (GpTexture *) 0xCC;
 1163     status = GdipCreateTextureIA (NULL, customAttributesInvalidWrap, 0, 0, 0, 2, &brush);
 1164     assertEqualInt (status, InvalidParameter);
 1165     assert (brush == (GpTexture *) 0xCC);
 1166 
 1167     brush = (GpTexture *) 0xCC;
 1168     status = GdipCreateTextureIA (NULL, customAttributesInvalidWrap, 0, 0, -1, 2, &brush);
 1169     assertEqualInt (status, InvalidParameter);
 1170     assert (brush == (GpTexture *) 0xCC);
 1171 
 1172     brush = (GpTexture *) 0xCC;
 1173     status = GdipCreateTextureIA (NULL, customAttributesInvalidWrap, 0, 0, 1, 0, &brush);
 1174     assertEqualInt (status, InvalidParameter);
 1175     assert (brush == (GpTexture *) 0xCC);
 1176 
 1177     brush = (GpTexture *) 0xCC;
 1178     status = GdipCreateTextureIA (NULL, customAttributesInvalidWrap, 0, 0, 1, -1, &brush);
 1179     assertEqualInt (status, InvalidParameter);
 1180     assert (brush == (GpTexture *) 0xCC);
 1181 
 1182     brush = (GpTexture *) 0xCC;
 1183     status = GdipCreateTextureIA (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1184     assertEqualInt (status, OutOfMemory);
 1185     assert (brush == NULL);
 1186 
 1187     brush = (GpTexture *) 0xCC;
 1188     status = GdipCreateTextureIA (wmfImage, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1189     assertEqualInt (status, OutOfMemory);
 1190     assert (brush == NULL);
 1191 
 1192     brush = (GpTexture *) 0xCC;
 1193     status = GdipCreateTextureIA (emfImage, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1194     assertEqualInt (status, OutOfMemory);
 1195     assert (brush == NULL);
 1196 
 1197     status = GdipCreateTextureIA (bitmapImage, NULL, -1, 0, 1, 2, &brush);
 1198     assertEqualInt (status, OutOfMemory);
 1199     assert (brush == NULL);
 1200 
 1201     brush = (GpTexture *) 0xCC;
 1202     status = GdipCreateTextureIA (bitmapImage, NULL, 0, -1, 1, 2, &brush);
 1203     assertEqualInt (status, OutOfMemory);
 1204     assert (brush == NULL);
 1205 
 1206     brush = (GpTexture *) 0xCC;
 1207     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, -1, 2, &brush);
 1208     assertEqualInt (status, OutOfMemory);
 1209     assert (brush == NULL);
 1210 
 1211     brush = (GpTexture *) 0xCC;
 1212     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, 0, 2, &brush);
 1213     assertEqualInt (status, OutOfMemory);
 1214     assert (brush == NULL);
 1215 
 1216     brush = (GpTexture *) 0xCC;
 1217     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, 1, 0, &brush);
 1218     assertEqualInt (status, OutOfMemory);
 1219     assert (brush == NULL);
 1220 
 1221     brush = (GpTexture *) 0xCC;
 1222     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, 1, -1, &brush);
 1223     assertEqualInt (status, OutOfMemory);
 1224     assert (brush == NULL);
 1225 
 1226     brush = (GpTexture *) 0xCC;
 1227     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, 101, 2, &brush);
 1228     assertEqualInt (status, OutOfMemory);
 1229     assert (brush == NULL);
 1230 
 1231     brush = (GpTexture *) 0xCC;
 1232     status = GdipCreateTextureIA (bitmapImage, NULL, 1, 0, 100, 2, &brush);
 1233     assertEqualInt (status, OutOfMemory);
 1234     assert (brush == NULL);
 1235 
 1236     brush = (GpTexture *) 0xCC;
 1237     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, 100, 69, &brush);
 1238     assertEqualInt (status, OutOfMemory);
 1239     assert (brush == NULL);
 1240 
 1241     brush = (GpTexture *) 0xCC;
 1242     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 1, 100, 68, &brush);
 1243     assertEqualInt (status, OutOfMemory);
 1244     assert (brush == NULL);
 1245 
 1246     brush = (GpTexture *) 0xCC;
 1247     status = GdipCreateTextureIA (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, 2, NULL);
 1248     assertEqualInt (status, InvalidParameter);
 1249     assert (brush == (GpTexture *) 0xCC);
 1250 
 1251     brush = (GpTexture *) 0xCC;
 1252     status = GdipCreateTextureIA (bitmapImage, NULL, 0, 0, 1, 2, NULL);
 1253     assertEqualInt (status, InvalidParameter);
 1254     assert (brush == (GpTexture *) 0xCC);
 1255 
 1256     brush = (GpTexture *) 0xCC;
 1257     status = GdipCreateTextureIA (bitmapImage, customAttributesInvalidWrap, 0, 0, 0, 2, NULL);
 1258     assertEqualInt (status, InvalidParameter);
 1259     assert (brush == (GpTexture *) 0xCC);
 1260 
 1261     brush = (GpTexture *) 0xCC;
 1262     status = GdipCreateTextureIA (bitmapImage, customAttributesInvalidWrap, 0, 0, -1, 2, NULL);
 1263     assertEqualInt (status, InvalidParameter);
 1264     assert (brush == (GpTexture *) 0xCC);
 1265 
 1266     brush = (GpTexture *) 0xCC;
 1267     status = GdipCreateTextureIA (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, 0, NULL);
 1268     assertEqualInt (status, InvalidParameter);
 1269     assert (brush == (GpTexture *) 0xCC);
 1270 
 1271     brush = (GpTexture *) 0xCC;
 1272     status = GdipCreateTextureIA (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, -1, NULL);
 1273     assertEqualInt (status, InvalidParameter);
 1274     assert (brush == (GpTexture *) 0xCC);
 1275 
 1276     GdipDisposeImage (bitmapImage);
 1277     GdipDisposeImage (wmfImage);
 1278     GdipDisposeImage (emfImage);
 1279     GdipDisposeImageAttributes (attributes);
 1280     GdipDisposeImageAttributes (customAttributes);
 1281     GdipDisposeImageAttributes (customAttributesClamp);
 1282     GdipDisposeImageAttributes (customAttributesInvalidWrap);
 1283 }
 1284 
 1285 static void test_createTextureIAI ()
 1286 {
 1287     GpStatus status;
 1288     GpImage *bitmapImage;
 1289     GpImage *wmfImage;
 1290     GpImage *emfImage;
 1291     GpImageAttributes *attributes;
 1292     GpImageAttributes *customAttributes;
 1293     GpImageAttributes *customAttributesClamp;
 1294     GpImageAttributes *customAttributesInvalidWrap;
 1295     GpTexture *brush;
 1296 
 1297     GdipLoadImageFromFile (bitmapFile, &bitmapImage);
 1298     GdipLoadImageFromFile (wmfFile, &wmfImage);
 1299     GdipLoadImageFromFile (emfFile, &emfImage);
 1300     GdipCreateImageAttributes (&attributes);
 1301     GdipCreateImageAttributes (&customAttributes);
 1302     GdipCreateImageAttributes (&customAttributesClamp);
 1303     GdipCreateImageAttributes (&customAttributesInvalidWrap);
 1304     GdipSetImageAttributesWrapMode (customAttributes, WrapModeTileFlipXY, 0xFF00FF00, FALSE);
 1305     GdipSetImageAttributesWrapMode (customAttributesClamp, WrapModeTileFlipXY, 0xFF00FF00, TRUE);
 1306     GdipSetImageAttributesWrapMode (customAttributesInvalidWrap, (WrapMode)(WrapModeClamp + 1), 0xFF00FF00, TRUE);
 1307 
 1308     // Bitmap image - full size.
 1309     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, 100, 68, &brush);
 1310     assertEqualInt (status, Ok);
 1311     verifyTexture (brush, WrapModeTile, 100, 68);
 1312 
 1313     GdipDeleteBrush ((GpBrush *) brush);
 1314 
 1315     // Bitmap image - custom size.
 1316     status = GdipCreateTextureIAI (bitmapImage, NULL, 5, 6, 7, 8, &brush);
 1317     assertEqualInt (status, Ok);
 1318     verifyTexture (brush, WrapModeTile, 7, 8);
 1319 
 1320     GdipDeleteBrush ((GpBrush *) brush);
 1321 
 1322     // Bitmap image - attributes with default wrap mode.
 1323     status = GdipCreateTextureIAI (bitmapImage, attributes, 0, 0, 2, 2, &brush);
 1324     assertEqualInt (status, Ok);
 1325     verifyTexture (brush, WrapModeClamp, 2, 2);
 1326 
 1327     GdipDeleteBrush ((GpBrush *) brush);
 1328 
 1329     // Bitmap image - attributes with custom wrap mode.
 1330     status = GdipCreateTextureIAI (bitmapImage, customAttributes, 0, 0, 2, 2, &brush);
 1331     assertEqualInt (status, Ok);
 1332     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1333 
 1334     GdipDeleteBrush ((GpBrush *) brush);
 1335 
 1336     // Bitmap image - attributes with custom wrap mode and clamp.
 1337     status = GdipCreateTextureIAI (bitmapImage, customAttributesClamp, 0, 0, 2, 2, &brush);
 1338     assertEqualInt (status, Ok);
 1339     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1340 
 1341     GdipDeleteBrush ((GpBrush *) brush);
 1342 
 1343     // Wmf image - full.
 1344     status = GdipCreateTextureIAI (wmfImage, NULL, 0, 0, 2, 2, &brush);
 1345     assertEqualInt (status, Ok);
 1346     verifyTexture (brush, WrapModeTile, 2, 2);
 1347 
 1348     GdipDeleteBrush ((GpBrush *) brush);
 1349 
 1350     // Wmf image - small size.
 1351     status = GdipCreateTextureIAI (wmfImage, NULL, 1, 1, 2, 2, &brush);
 1352     assertEqualInt (status, Ok);
 1353     verifyTexture (brush, WrapModeTile, 2, 2);
 1354 
 1355     GdipDeleteBrush ((GpBrush *) brush);
 1356 
 1357     // Wmf image - negative x and y.
 1358     status = GdipCreateTextureIAI (wmfImage, NULL, -10, -10, 2, 2, &brush);
 1359     assertEqualInt (status, Ok);
 1360     verifyTexture (brush, WrapModeTile, 2, 2);
 1361 
 1362     GdipDeleteBrush ((GpBrush *) brush);
 1363 
 1364     // Wmf image - large x and y.
 1365     status = GdipCreateTextureIAI (wmfImage, NULL, 2000, 2000, 2, 2, &brush);
 1366     assertEqualInt (status, Ok);
 1367     verifyTexture (brush, WrapModeTile, 2, 2);
 1368 
 1369     GdipDeleteBrush ((GpBrush *) brush);
 1370 
 1371     // Wmf image, zero width.
 1372     status = GdipCreateTextureIAI (wmfImage, NULL, 1, 1, 0, 2, &brush);
 1373     assertEqualInt (status, Ok);
 1374     verifyTexture (brush, WrapModeTile, 770, 649);
 1375 
 1376     GdipDeleteBrush ((GpBrush *) brush);
 1377 
 1378     // Wmf image, zero height.
 1379     status = GdipCreateTextureIAI (wmfImage, NULL, 1, 1, 2, 0, &brush);
 1380     assertEqualInt (status, Ok);
 1381     verifyTexture (brush, WrapModeTile, 770, 649);
 1382 
 1383     GdipDeleteBrush ((GpBrush *) brush);
 1384 
 1385     // Wmf image, negative width.
 1386     status = GdipCreateTextureIAI (wmfImage, NULL, 1, 1, -1, 2, &brush);
 1387     assertEqualInt (status, Ok);
 1388     verifyTexture (brush, WrapModeTile, 770, 649);
 1389 
 1390     GdipDeleteBrush ((GpBrush *) brush);
 1391 
 1392     // Wmf image, negative height.
 1393     status = GdipCreateTextureIAI (wmfImage, NULL, 1, 1, 2, -1, &brush);
 1394     assertEqualInt (status, Ok);
 1395     verifyTexture (brush, WrapModeTile, 770, 649);
 1396 
 1397     GdipDeleteBrush ((GpBrush *) brush);
 1398 
 1399     // Wmf image - attributes with default wrap mode.
 1400     status = GdipCreateTextureIAI (wmfImage, attributes, 0, 0, 2, 2, &brush);
 1401     assertEqualInt (status, Ok);
 1402     verifyTexture (brush, WrapModeClamp, 2, 2);
 1403 
 1404     GdipDeleteBrush ((GpBrush *) brush);
 1405 
 1406     // Wmf image - attributes with custom wrap mode.
 1407     status = GdipCreateTextureIAI (wmfImage, customAttributes, 0, 0, 2, 2, &brush);
 1408     assertEqualInt (status, Ok);
 1409     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1410 
 1411     GdipDeleteBrush ((GpBrush *) brush);
 1412 
 1413     // Wmf image - attributes with custom wrap mode and clamp.
 1414     status = GdipCreateTextureIAI (wmfImage, customAttributesClamp, 0, 0, 2, 2, &brush);
 1415     assertEqualInt (status, Ok);
 1416     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1417 
 1418     GdipDeleteBrush ((GpBrush *) brush);
 1419 
 1420     // Emf image - non zero.
 1421     status = GdipCreateTextureIAI (emfImage, NULL, 0, 0, 100, 100, &brush);
 1422     assertEqualInt (status, Ok);
 1423     verifyTexture (brush, WrapModeTile, 100, 100);
 1424 
 1425     GdipDeleteBrush ((GpBrush *) brush);
 1426 
 1427     // Emf image - non zero.
 1428     status = GdipCreateTextureIAI (emfImage, NULL, 1, 1, 50, 60, &brush);
 1429     assertEqualInt (status, Ok);
 1430     verifyTexture (brush, WrapModeTile, 50, 60);
 1431 
 1432     GdipDeleteBrush ((GpBrush *) brush);
 1433 
 1434     // Emf image - negative x and y.
 1435     status = GdipCreateTextureIAI (emfImage, NULL, -10, -10, 2, 2, &brush);
 1436     assertEqualInt (status, Ok);
 1437     verifyTexture (brush, WrapModeTile, 2, 2);
 1438 
 1439     GdipDeleteBrush ((GpBrush *) brush);
 1440 
 1441     // Emf image - large x and y.
 1442     status = GdipCreateTextureIAI (emfImage, NULL, 2000, 2000, 2, 2, &brush);
 1443     assertEqualInt (status, Ok);
 1444     verifyTexture (brush, WrapModeTile, 2, 2);
 1445 
 1446     GdipDeleteBrush ((GpBrush *) brush);
 1447 
 1448     // Emf image, zero width.
 1449     status = GdipCreateTextureIAI (emfImage, NULL, 1, 1, 0, 2, &brush);
 1450     assertEqualInt (status, Ok);
 1451     verifyTexture (brush, WrapModeTile, 100, 100);
 1452 
 1453     GdipDeleteBrush ((GpBrush *) brush);
 1454 
 1455     // Emf image, zero height.
 1456     status = GdipCreateTextureIAI (emfImage, NULL, 1, 1, 2, 0, &brush);
 1457     assertEqualInt (status, Ok);
 1458     verifyTexture (brush, WrapModeTile, 100, 100);
 1459 
 1460     GdipDeleteBrush ((GpBrush *) brush);
 1461 
 1462     // Emf image, negative width.
 1463     status = GdipCreateTextureIAI (emfImage, NULL, 1, 1, -1, 2, &brush);
 1464     assertEqualInt (status, Ok);
 1465     verifyTexture (brush, WrapModeTile, 100, 100);
 1466 
 1467     GdipDeleteBrush ((GpBrush *) brush);
 1468 
 1469     // Emf image, negative height.
 1470     status = GdipCreateTextureIAI (emfImage, NULL, 1, 1, 2, -1, &brush);
 1471     assertEqualInt (status, Ok);
 1472     verifyTexture (brush, WrapModeTile, 100, 100);
 1473 
 1474     GdipDeleteBrush ((GpBrush *) brush);
 1475 
 1476     // Emf image - attributes with default wrap mode.
 1477     status = GdipCreateTextureIAI (emfImage, attributes, 0, 0, 2, 2, &brush);
 1478     assertEqualInt (status, Ok);
 1479     verifyTexture (brush, WrapModeClamp, 2, 2);
 1480 
 1481     GdipDeleteBrush ((GpBrush *) brush);
 1482 
 1483     // Emf image - attributes with custom wrap mode.
 1484     status = GdipCreateTextureIAI (emfImage, customAttributes, 0, 0, 2, 2, &brush);
 1485     assertEqualInt (status, Ok);
 1486     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1487 
 1488     GdipDeleteBrush ((GpBrush *) brush);
 1489 
 1490     // Emf image - attributes with custom wrap mode and clamp.
 1491     status = GdipCreateTextureIAI (emfImage, customAttributesClamp, 0, 0, 2, 2, &brush);
 1492     assertEqualInt (status, Ok);
 1493     verifyTexture (brush, WrapModeTileFlipXY, 2, 2);
 1494 
 1495     GdipDeleteBrush ((GpBrush *) brush);
 1496 
 1497     // Negative tests.
 1498     brush = (GpTexture *) 0xCC;
 1499     status = GdipCreateTextureIAI (NULL, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1500     assertEqualInt (status, InvalidParameter);
 1501     assert (brush == (GpTexture *) 0xCC);
 1502 
 1503     brush = (GpTexture *) 0xCC;
 1504     status = GdipCreateTextureIAI (NULL, NULL, 0, 0, 1, 2, &brush);
 1505     assertEqualInt (status, InvalidParameter);
 1506     assert (brush == (GpTexture *) 0xCC);
 1507 
 1508     brush = (GpTexture *) 0xCC;
 1509     status = GdipCreateTextureIAI (NULL, customAttributesInvalidWrap, 0, 0, 0, 2, &brush);
 1510     assertEqualInt (status, InvalidParameter);
 1511     assert (brush == (GpTexture *) 0xCC);
 1512 
 1513     brush = (GpTexture *) 0xCC;
 1514     status = GdipCreateTextureIAI (NULL, customAttributesInvalidWrap, 0, 0, -1, 2, &brush);
 1515     assertEqualInt (status, InvalidParameter);
 1516     assert (brush == (GpTexture *) 0xCC);
 1517 
 1518     brush = (GpTexture *) 0xCC;
 1519     status = GdipCreateTextureIAI (NULL, customAttributesInvalidWrap, 0, 0, 1, 0, &brush);
 1520     assertEqualInt (status, InvalidParameter);
 1521     assert (brush == (GpTexture *) 0xCC);
 1522 
 1523     brush = (GpTexture *) 0xCC;
 1524     status = GdipCreateTextureIAI (NULL, customAttributesInvalidWrap, 0, 0, 1, -1, &brush);
 1525     assertEqualInt (status, InvalidParameter);
 1526     assert (brush == (GpTexture *) 0xCC);
 1527 
 1528     brush = (GpTexture *) 0xCC;
 1529     status = GdipCreateTextureIAI (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1530     assertEqualInt (status, OutOfMemory);
 1531     assert (brush == NULL);
 1532 
 1533     brush = (GpTexture *) 0xCC;
 1534     status = GdipCreateTextureIAI (wmfImage, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1535     assertEqualInt (status, OutOfMemory);
 1536     assert (brush == NULL);
 1537 
 1538     brush = (GpTexture *) 0xCC;
 1539     status = GdipCreateTextureIAI (emfImage, customAttributesInvalidWrap, 0, 0, 1, 2, &brush);
 1540     assertEqualInt (status, OutOfMemory);
 1541     assert (brush == NULL);
 1542 
 1543     status = GdipCreateTextureIAI (bitmapImage, NULL, -1, 0, 1, 2, &brush);
 1544     assertEqualInt (status, OutOfMemory);
 1545     assert (brush == NULL);
 1546 
 1547     brush = (GpTexture *) 0xCC;
 1548     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, -1, 1, 2, &brush);
 1549     assertEqualInt (status, OutOfMemory);
 1550     assert (brush == NULL);
 1551 
 1552     brush = (GpTexture *) 0xCC;
 1553     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, -1, 2, &brush);
 1554     assertEqualInt (status, OutOfMemory);
 1555     assert (brush == NULL);
 1556 
 1557     brush = (GpTexture *) 0xCC;
 1558     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, 0, 2, &brush);
 1559     assertEqualInt (status, OutOfMemory);
 1560     assert (brush == NULL);
 1561 
 1562     brush = (GpTexture *) 0xCC;
 1563     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, 1, 0, &brush);
 1564     assertEqualInt (status, OutOfMemory);
 1565     assert (brush == NULL);
 1566 
 1567     brush = (GpTexture *) 0xCC;
 1568     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, 1, -1, &brush);
 1569     assertEqualInt (status, OutOfMemory);
 1570     assert (brush == NULL);
 1571 
 1572     brush = (GpTexture *) 0xCC;
 1573     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, 101, 2, &brush);
 1574     assertEqualInt (status, OutOfMemory);
 1575     assert (brush == NULL);
 1576 
 1577     brush = (GpTexture *) 0xCC;
 1578     status = GdipCreateTextureIAI (bitmapImage, NULL, 1, 0, 100, 2, &brush);
 1579     assertEqualInt (status, OutOfMemory);
 1580     assert (brush == NULL);
 1581 
 1582     brush = (GpTexture *) 0xCC;
 1583     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, 100, 69, &brush);
 1584     assertEqualInt (status, OutOfMemory);
 1585     assert (brush == NULL);
 1586 
 1587     brush = (GpTexture *) 0xCC;
 1588     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 1, 100, 68, &brush);
 1589     assertEqualInt (status, OutOfMemory);
 1590     assert (brush == NULL);
 1591 
 1592     brush = (GpTexture *) 0xCC;
 1593     status = GdipCreateTextureIAI (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, 2, NULL);
 1594     assertEqualInt (status, InvalidParameter);
 1595     assert (brush == (GpTexture *) 0xCC);
 1596 
 1597     brush = (GpTexture *) 0xCC;
 1598     status = GdipCreateTextureIAI (bitmapImage, NULL, 0, 0, 1, 2, NULL);
 1599     assertEqualInt (status, InvalidParameter);
 1600     assert (brush == (GpTexture *) 0xCC);
 1601 
 1602     brush = (GpTexture *) 0xCC;
 1603     status = GdipCreateTextureIAI (bitmapImage, customAttributesInvalidWrap, 0, 0, 0, 2, NULL);
 1604     assertEqualInt (status, InvalidParameter);
 1605     assert (brush == (GpTexture *) 0xCC);
 1606 
 1607     brush = (GpTexture *) 0xCC;
 1608     status = GdipCreateTextureIAI (bitmapImage, customAttributesInvalidWrap, 0, 0, -1, 2, NULL);
 1609     assertEqualInt (status, InvalidParameter);
 1610     assert (brush == (GpTexture *) 0xCC);
 1611 
 1612     brush = (GpTexture *) 0xCC;
 1613     status = GdipCreateTextureIAI (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, 0, NULL);
 1614     assertEqualInt (status, InvalidParameter);
 1615     assert (brush == (GpTexture *) 0xCC);
 1616 
 1617     brush = (GpTexture *) 0xCC;
 1618     status = GdipCreateTextureIAI (bitmapImage, customAttributesInvalidWrap, 0, 0, 1, -1, NULL);
 1619     assertEqualInt (status, InvalidParameter);
 1620     assert (brush == (GpTexture *) 0xCC);
 1621 
 1622     GdipDisposeImage (bitmapImage);
 1623     GdipDisposeImage (wmfImage);
 1624     GdipDisposeImage (emfImage);
 1625     GdipDisposeImageAttributes (attributes);
 1626     GdipDisposeImageAttributes (customAttributes);
 1627     GdipDisposeImageAttributes (customAttributesClamp);
 1628     GdipDisposeImageAttributes (customAttributesInvalidWrap);
 1629 }
 1630 
 1631 static void test_getTextureImage ()
 1632 {
 1633     GpStatus status;
 1634     GpImage *image;
 1635     GpTexture *brush;
 1636     GpImage *brushImage1;
 1637     GpImage *brushImage2;
 1638 
 1639     GdipLoadImageFromFile (bitmapFile, &image);
 1640 
 1641     GdipCreateTexture (image, WrapModeTile, &brush);
 1642 
 1643     status = GdipGetTextureImage (brush, &brushImage1);
 1644     assertEqualInt (status, Ok);
 1645     assert (brushImage1 != image && "The texture image should be a clone.");
 1646 
 1647     status = GdipGetTextureImage (brush, &brushImage2);
 1648     assertEqualInt (status, Ok);
 1649     assert (brushImage2 != brushImage1 && "The texture image should be a clone.");
 1650 
 1651     // Negative tests.
 1652     status = GdipGetTextureImage (NULL, &brushImage1);
 1653     assertEqualInt (status, InvalidParameter);
 1654 
 1655     status = GdipGetTextureImage (brush, NULL);
 1656     assertEqualInt (status, InvalidParameter);
 1657 
 1658     GdipDeleteBrush ((GpBrush *) brush);
 1659     GdipDisposeImage (image);
 1660     GdipDisposeImage (brushImage1);
 1661     GdipDisposeImage (brushImage2);
 1662 }
 1663 
 1664 static void test_getTextureWrapMode ()
 1665 {
 1666     GpStatus status;
 1667     GpImage *image;
 1668     GpTexture *brush;
 1669     GpWrapMode wrapMode;
 1670 
 1671     GdipLoadImageFromFile (bitmapFile, &image);
 1672     GdipCreateTexture (image, WrapModeTile, &brush);
 1673 
 1674     // Negative tests.
 1675     status = GdipGetTextureWrapMode (NULL, &wrapMode);
 1676     assertEqualInt (status, InvalidParameter);
 1677 
 1678     status = GdipGetTextureWrapMode (brush, NULL);
 1679     assertEqualInt (status, InvalidParameter);
 1680 
 1681     GdipDeleteBrush ((GpBrush *) brush);
 1682     GdipDisposeImage (image);
 1683 }
 1684 
 1685 static void test_setTextureWrapMode ()
 1686 {
 1687     GpStatus status;
 1688     GpImage *image;
 1689     GpTexture *brush;
 1690     GpWrapMode wrapMode;
 1691 
 1692     GdipLoadImageFromFile (bitmapFile, &image);
 1693     GdipCreateTexture (image, WrapModeTile, &brush);
 1694 
 1695     // WrapModeTileFlipX.
 1696     status = GdipSetTextureWrapMode (brush, WrapModeTileFlipX);
 1697     assertEqualInt (status, Ok);
 1698 
 1699     GdipGetTextureWrapMode (brush, &wrapMode);
 1700     assertEqualInt (wrapMode, WrapModeTileFlipX);
 1701 
 1702     // WrapModeTileFlipY.
 1703     status = GdipSetTextureWrapMode (brush, WrapModeTileFlipY);
 1704     assertEqualInt (status, Ok);
 1705 
 1706     GdipGetTextureWrapMode (brush, &wrapMode);
 1707     assertEqualInt (wrapMode, WrapModeTileFlipY);
 1708 
 1709     // WrapModeTileFlipXY.
 1710     status = GdipSetTextureWrapMode (brush, WrapModeTileFlipXY);
 1711     assertEqualInt (status, Ok);
 1712 
 1713     GdipGetTextureWrapMode (brush, &wrapMode);
 1714     assertEqualInt (wrapMode, WrapModeTileFlipXY);
 1715 
 1716     // WrapModeClamp.
 1717     status = GdipSetTextureWrapMode (brush, WrapModeClamp);
 1718     assertEqualInt (status, Ok);
 1719 
 1720     GdipGetTextureWrapMode (brush, &wrapMode);
 1721     assertEqualInt (wrapMode, WrapModeClamp);
 1722 
 1723     // Invalid WrapMode - nop.
 1724     status = GdipSetTextureWrapMode (brush, (WrapMode)(WrapModeClamp + 1));
 1725     assertEqualInt (status, Ok);
 1726 
 1727     GdipGetTextureWrapMode (brush, &wrapMode);
 1728     assertEqualInt (wrapMode, WrapModeClamp);
 1729 
 1730     // Negative tests.
 1731     status = GdipSetTextureWrapMode (NULL, wrapMode);
 1732     assertEqualInt (status, InvalidParameter);
 1733 
 1734     GdipDeleteBrush ((GpBrush *) brush);
 1735     GdipDisposeImage (image);
 1736 }
 1737 
 1738 static void test_getTextureTransform ()
 1739 {
 1740     GpStatus status;
 1741     GpImage *image;
 1742     GpTexture *brush;
 1743     GpMatrix *transform;
 1744 
 1745     GdipLoadImageFromFile (bitmapFile, &image);
 1746     GdipCreateTexture (image, WrapModeTile, &brush);
 1747     GdipCreateMatrix (&transform);
 1748 
 1749     // Negative tests.
 1750     status = GdipGetTextureTransform (NULL, transform);
 1751     assertEqualInt (status, InvalidParameter);
 1752 
 1753     status = GdipGetTextureTransform (brush, NULL);
 1754     assertEqualInt (status, InvalidParameter);
 1755 
 1756     GdipDeleteBrush ((GpBrush *) brush);
 1757     GdipDisposeImage (image);
 1758     GdipDeleteMatrix (transform);
 1759 }
 1760 
 1761 static void test_setTextureTransform ()
 1762 {
 1763     GpStatus status;
 1764     GpImage *image;
 1765     GpTexture *brush;
 1766     GpMatrix *matrix;
 1767     GpMatrix *nonInvertibleMatrix;
 1768     GpMatrix *transform;
 1769 
 1770     GdipLoadImageFromFile (bitmapFile, &image);
 1771     GdipCreateTexture (image, WrapModeTile, &brush);
 1772     GdipCreateMatrix2 (1, 2, 3, 4, 5, 6, &matrix);
 1773     GdipCreateMatrix2 (123, 24, 82, 16, 47, 30, &nonInvertibleMatrix);
 1774     GdipCreateMatrix (&transform);
 1775 
 1776     status = GdipSetTextureTransform (brush, matrix);
 1777     assertEqualInt (status, Ok);
 1778 
 1779     GdipGetTextureTransform (brush, transform);
 1780     assert (transform != matrix && "Expected new matrix to be a clone.");
 1781     verifyMatrix (transform, 1, 2, 3, 4, 5, 6);
 1782 
 1783     // Changing the original transform should not modify the brush's transform.
 1784     GdipSetMatrixElements (matrix, 2, 3, 4, 5, 6, 7);
 1785     GdipGetTextureTransform (brush, transform);
 1786     verifyMatrix (transform, 1, 2, 3, 4, 5, 6);
 1787 
 1788     // Negative tests.
 1789     status = GdipSetTextureTransform (NULL, transform);
 1790     assertEqualInt (status, InvalidParameter);
 1791 
 1792     status = GdipSetTextureTransform (brush, NULL);
 1793     assertEqualInt (status, InvalidParameter);
 1794 
 1795     status = GdipSetTextureTransform (brush, nonInvertibleMatrix);
 1796     assertEqualInt (status, InvalidParameter);
 1797 
 1798     GdipDeleteBrush ((GpBrush *) brush);
 1799     GdipDisposeImage (image);
 1800     GdipDeleteMatrix (matrix);
 1801     GdipDeleteMatrix (nonInvertibleMatrix);
 1802     GdipDeleteMatrix (transform);
 1803 }
 1804 
 1805 static void test_resetTextureTransform ()
 1806 {
 1807     GpStatus status;
 1808     GpImage *image;
 1809     GpTexture *brush;
 1810     GpMatrix *matrix;
 1811     GpMatrix *transform;
 1812 
 1813     GdipLoadImageFromFile (bitmapFile, &image);
 1814     GdipCreateTexture (image, WrapModeTile, &brush);
 1815     GdipCreateMatrix2 (1, 2, 3, 4, 5, 6, &matrix);
 1816     GdipCreateMatrix (&transform);
 1817 
 1818     GdipSetTextureTransform (brush, matrix);
 1819 
 1820     status = GdipResetTextureTransform (brush);
 1821     assertEqualInt (status, Ok);
 1822 
 1823     GdipGetTextureTransform (brush, transform);
 1824     verifyMatrix (transform, 1, 0, 0, 1, 0, 0);
 1825 
 1826     // Negative tests.
 1827     status = GdipResetTextureTransform (NULL);
 1828     assertEqualInt (status, InvalidParameter);
 1829 
 1830     GdipDeleteBrush ((GpBrush *) brush);
 1831     GdipDisposeImage (image);
 1832     GdipDeleteMatrix (matrix);
 1833 }
 1834 
 1835 static void test_multiplyTextureTransform ()
 1836 {
 1837     GpStatus status;
 1838     GpImage *image;
 1839     GpTexture *brush;
 1840     GpMatrix *originalTransform;
 1841     GpMatrix *matrix;
 1842     GpMatrix *nonInvertibleMatrix;
 1843     GpMatrix *transform;
 1844 
 1845     GdipLoadImageFromFile (bitmapFile, &image);
 1846     GdipCreateTexture (image, WrapModeTile, &brush);
 1847     GdipCreateMatrix2 (1, 2, 3, 4, 5, 6, &originalTransform);
 1848     GdipCreateMatrix2 (2, 3, 4, 5, 6, 7, &matrix);
 1849     GdipCreateMatrix2 (123, 24, 82, 16, 47, 30, &nonInvertibleMatrix);
 1850     GdipCreateMatrix (&transform);
 1851 
 1852     // MatrixOrderAppend.
 1853     GdipSetTextureTransform (brush, originalTransform);
 1854 
 1855     status = GdipMultiplyTextureTransform (brush, matrix, MatrixOrderAppend);
 1856     assertEqualInt (status, Ok);
 1857 
 1858     GdipGetTextureTransform (brush, transform);
 1859     verifyMatrix (transform, 10, 13, 22, 29, 40, 52);
 1860 
 1861     // MatrixOrderPrepend.
 1862     GdipSetTextureTransform (brush, originalTransform);
 1863 
 1864     status = GdipMultiplyTextureTransform (brush, matrix, MatrixOrderPrepend);
 1865     assertEqualInt (status, Ok);
 1866 
 1867     GdipGetTextureTransform (brush, transform);
 1868     verifyMatrix (transform, 11, 16, 19, 28, 32, 46);
 1869 
 1870     // Null matrix.
 1871     status = GdipMultiplyTextureTransform (brush, NULL, MatrixOrderAppend);
 1872     assertEqualInt (status, Ok);
 1873 
 1874     GdipGetTextureTransform (brush, transform);
 1875     verifyMatrix (transform, 11, 16, 19, 28, 32, 46);
 1876 
 1877     // Invalid MatrixOrder - negative.
 1878     GdipSetTextureTransform (brush, originalTransform);
 1879 
 1880     status = GdipMultiplyTextureTransform (brush, matrix, (MatrixOrder)(MatrixOrderPrepend - 1));
 1881     assertEqualInt (status, Ok);
 1882 
 1883     GdipGetTextureTransform (brush, transform);
 1884     verifyMatrix (transform, 10, 13, 22, 29, 40, 52);
 1885 
 1886     // Invalid MatrixOrder - positive.
 1887     GdipSetTextureTransform (brush, originalTransform);
 1888 
 1889     status = GdipMultiplyTextureTransform (brush, matrix, (MatrixOrder)(MatrixOrderAppend + 1));
 1890     assertEqualInt (status, Ok);
 1891 
 1892     GdipGetTextureTransform (brush, transform);
 1893     verifyMatrix (transform, 10, 13, 22, 29, 40, 52);
 1894 
 1895     // Negative tests.
 1896     status = GdipMultiplyTextureTransform (NULL, matrix, MatrixOrderAppend);
 1897     assertEqualInt (status, InvalidParameter);
 1898 
 1899     status = GdipMultiplyTextureTransform (brush, nonInvertibleMatrix, MatrixOrderAppend);
 1900     assertEqualInt (status, InvalidParameter);
 1901 
 1902     GdipDeleteBrush ((GpBrush *) brush);
 1903     GdipDisposeImage (image);
 1904     GdipDeleteMatrix (originalTransform);
 1905     GdipDeleteMatrix (matrix);
 1906     GdipDeleteMatrix (nonInvertibleMatrix);
 1907     GdipDeleteMatrix (transform);
 1908 }
 1909 
 1910 static void test_translateTextureTransform ()
 1911 {
 1912     GpStatus status;
 1913     GpImage *image;
 1914     GpTexture *brush;
 1915     GpMatrix *originalTransform;
 1916     GpMatrix *transform;
 1917 
 1918     GdipLoadImageFromFile (bitmapFile, &image);
 1919     GdipCreateTexture (image, WrapModeTile, &brush);
 1920     GdipCreateMatrix2 (1, 2, 3, 4, 5, 6, &originalTransform);
 1921     GdipCreateMatrix (&transform);
 1922 
 1923     // MatrixOrderAppend.
 1924     GdipSetTextureTransform (brush, originalTransform);
 1925 
 1926     status = GdipTranslateTextureTransform (brush, 5, 6, MatrixOrderAppend);
 1927     assertEqualInt (status, Ok);
 1928 
 1929     GdipGetTextureTransform (brush, transform);
 1930     verifyMatrix (transform, 1, 2, 3, 4, 10, 12);
 1931 
 1932     // MatrixOrderPrepend.
 1933     GdipSetTextureTransform (brush, originalTransform);
 1934 
 1935     status = GdipTranslateTextureTransform (brush, 5, 6, MatrixOrderPrepend);
 1936     assertEqualInt (status, Ok);
 1937 
 1938     GdipGetTextureTransform (brush, transform);
 1939     verifyMatrix (transform, 1, 2, 3, 4, 28, 40);
 1940 
 1941     // Negative tests.
 1942     status = GdipTranslateTextureTransform (NULL, 1, 1, MatrixOrderAppend);
 1943     assertEqualInt (status, InvalidParameter);
 1944 
 1945     status = GdipTranslateTextureTransform (brush, 1, 1, (MatrixOrder)(MatrixOrderPrepend - 1));
 1946     assertEqualInt (status, InvalidParameter);
 1947 
 1948     status = GdipTranslateTextureTransform (brush, 1, 1, (MatrixOrder)(MatrixOrderAppend + 1));
 1949     assertEqualInt (status, InvalidParameter);
 1950 
 1951     GdipDeleteBrush ((GpBrush *) brush);
 1952     GdipDisposeImage (image);
 1953     GdipDeleteMatrix (originalTransform);
 1954     GdipDeleteMatrix (transform);
 1955 }
 1956 
 1957 static void test_scaleTextureTransform ()
 1958 {
 1959     GpStatus status;
 1960     GpImage *image;
 1961     GpTexture *brush;
 1962     GpMatrix *originalTransform;
 1963     GpMatrix *transform;
 1964 
 1965     GdipLoadImageFromFile (bitmapFile, &image);
 1966     GdipCreateTexture (image, WrapModeTile, &brush);
 1967     GdipCreateMatrix2 (1, 2, 3, 4, 5, 6, &originalTransform);
 1968     GdipCreateMatrix (&transform);
 1969 
 1970     // MatrixOrderAppend.
 1971     GdipSetTextureTransform (brush, originalTransform);
 1972 
 1973     status = GdipScaleTextureTransform (brush, 0.5, 0.75, MatrixOrderAppend);
 1974     assertEqualInt (status, Ok);
 1975 
 1976     GdipGetTextureTransform (brush, transform);
 1977     verifyMatrix (transform, 0.5, 1.5, 1.5, 3, 2.5, 4.5);
 1978 
 1979     // MatrixOrderPrepend.
 1980     GdipSetTextureTransform (brush, originalTransform);
 1981 
 1982     status = GdipScaleTextureTransform (brush, 0.5, 0.75, MatrixOrderPrepend);
 1983     assertEqualInt (status, Ok);
 1984 
 1985     GdipGetTextureTransform (brush, transform);
 1986     verifyMatrix (transform, 0.5, 1, 2.25, 3, 5, 6);
 1987 
 1988     // Negative tests.
 1989     status = GdipScaleTextureTransform (NULL, 1, 1, MatrixOrderAppend);
 1990     assertEqualInt (status, InvalidParameter);
 1991 
 1992     status = GdipScaleTextureTransform (brush, 1, 1, (MatrixOrder)(MatrixOrderPrepend - 1));
 1993     assertEqualInt (status, InvalidParameter);
 1994 
 1995     status = GdipScaleTextureTransform (brush, 1, 1, (MatrixOrder)(MatrixOrderAppend + 1));
 1996     assertEqualInt (status, InvalidParameter);
 1997 
 1998     GdipDeleteBrush ((GpBrush *) brush);
 1999     GdipDisposeImage (image);
 2000     GdipDeleteMatrix (originalTransform);
 2001     GdipDeleteMatrix (transform);
 2002 }
 2003 
 2004 static void test_rotateTextureTransform ()
 2005 {
 2006     GpStatus status;
 2007     GpImage *image;
 2008     GpTexture *brush;
 2009     GpMatrix *originalTransform;
 2010     GpMatrix *transform;
 2011 
 2012     GdipLoadImageFromFile (bitmapFile, &image);
 2013     GdipCreateTexture (image, WrapModeTile, &brush);
 2014     GdipCreateMatrix2 (1, 2, 3, 4, 5, 6, &originalTransform);
 2015     GdipCreateMatrix (&transform);
 2016 
 2017     // MatrixOrderAppend.
 2018     GdipSetTextureTransform (brush, originalTransform);
 2019 
 2020     status = GdipRotateTextureTransform (brush, 90, MatrixOrderAppend);
 2021     assertEqualInt (status, Ok);
 2022 
 2023     GdipGetTextureTransform (brush, transform);
 2024     verifyMatrix (transform, -2, 1, -4, 3, -6, 5);
 2025 
 2026     // MatrixOrderPrepend.
 2027     GdipSetTextureTransform (brush, originalTransform);
 2028 
 2029     status = GdipRotateTextureTransform (brush, 90, MatrixOrderPrepend);
 2030     assertEqualInt (status, Ok);
 2031 
 2032     GdipGetTextureTransform (brush, transform);
 2033     verifyMatrix (transform, 3, 4, -1, -2, 5, 6);
 2034 
 2035     // Negative tests.
 2036     status = GdipRotateTextureTransform (NULL, 90, MatrixOrderAppend);
 2037     assertEqualInt (status, InvalidParameter);
 2038 
 2039     status = GdipRotateTextureTransform (brush, 90, (MatrixOrder)(MatrixOrderPrepend - 1));
 2040     assertEqualInt (status, InvalidParameter);
 2041 
 2042     status = GdipRotateTextureTransform (brush, 90, (MatrixOrder)(MatrixOrderAppend + 1));
 2043     assertEqualInt (status, InvalidParameter);
 2044 
 2045     GdipDeleteBrush ((GpBrush *) brush);
 2046     GdipDisposeImage (image);
 2047     GdipDeleteMatrix (originalTransform);
 2048     GdipDeleteMatrix (transform);
 2049 }
 2050 
 2051 int
 2052 main (int argc, char**argv)
 2053 {
 2054     STARTUP;
 2055 
 2056     test_clone ();
 2057     test_delete ();
 2058     test_createTexture ();
 2059     test_createTexture2 ();
 2060     test_createTexture2I ();
 2061     test_createTextureIA ();
 2062     test_createTextureIAI ();
 2063     test_getTextureImage ();
 2064     test_getTextureWrapMode ();
 2065     test_setTextureWrapMode ();
 2066     test_getTextureTransform ();
 2067     test_setTextureTransform ();
 2068     test_resetTextureTransform ();
 2069     test_multiplyTextureTransform ();
 2070     test_translateTextureTransform ();
 2071     test_scaleTextureTransform ();
 2072     test_rotateTextureTransform ();
 2073 
 2074     SHUTDOWN;
 2075     return 0;
 2076 }