"Fossies" - the Fresh Open Source Software Archive

Member "libgdiplus-6.0.2/tests/testcustomlinecap.c" (2 Aug 2019, 20907 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")
   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 <math.h>
   23 #include <stdio.h>
   24 #include <stdlib.h>
   25 #include <string.h>
   26 #include "testhelpers.h"
   27 
   28 static void verifyCustomLineCap (GpCustomLineCap *cap, LineCap expectedBaseCap, REAL expectedBaseInset)
   29 {
   30     assert (cap && "Expected cap to be initialized.");
   31 
   32     GpStatus status;
   33     LineCap baseCap;
   34     REAL baseInset;
   35     LineCap startCap;
   36     LineCap endCap;
   37     LineJoin strokeJoin;
   38     REAL widthScale;
   39     CustomLineCapType type;
   40 
   41     status = GdipGetCustomLineCapBaseCap (cap, &baseCap);
   42     assertEqualInt (status, Ok);
   43     assertEqualInt (baseCap, expectedBaseCap);
   44 
   45     status = GdipGetCustomLineCapBaseInset (cap, &baseInset);
   46     assertEqualInt (status, Ok);
   47     assertEqualFloat (baseInset, expectedBaseInset);
   48 
   49     status = GdipGetCustomLineCapStrokeCaps (cap, &startCap, &endCap);
   50     assertEqualInt (status, Ok);
   51     assertEqualInt (startCap, LineCapFlat);
   52     assertEqualInt (endCap, LineCapFlat);
   53 
   54     status = GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
   55     assertEqualInt (status, Ok);
   56     assertEqualInt (strokeJoin, LineJoinMiter);
   57 
   58     status = GdipGetCustomLineCapType (cap, &type);
   59     assertEqualInt (status, Ok);
   60     assertEqualInt (type, CustomLineCapTypeDefault);
   61 
   62     status = GdipGetCustomLineCapWidthScale (cap, &widthScale);
   63     assertEqualInt (status, Ok);
   64     assertEqualFloat (widthScale, 1);
   65 }
   66 
   67 static void test_createCustomLineCap ()
   68 {
   69     GpStatus status;
   70     GpCustomLineCap *cap;
   71     GpPath *fillPath;
   72     GpPath *strokePath;
   73 
   74     GdipCreatePath (FillModeAlternate, &fillPath);
   75     GdipCreatePath (FillModeAlternate, &strokePath);
   76 
   77     status = GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
   78     assertEqualInt (status, Ok);
   79     verifyCustomLineCap (cap, LineCapFlat, 10);
   80     GdipDeleteCustomLineCap (cap);
   81 
   82     status = GdipCreateCustomLineCap (NULL, strokePath, LineCapCustom, 0, &cap);
   83     assertEqualInt (status, Ok);
   84     verifyCustomLineCap (cap, LineCapFlat, 0);
   85     GdipDeleteCustomLineCap (cap);
   86 
   87     status = GdipCreateCustomLineCap (fillPath, NULL, (LineCap)(LineCapFlat - 1), -1, &cap);
   88     assertEqualInt (status, Ok);
   89     verifyCustomLineCap (cap, LineCapFlat, -1);
   90     GdipDeleteCustomLineCap (cap);
   91 
   92     status = GdipCreateCustomLineCap (fillPath, strokePath, (LineCap)(LineCapCustom + 1), 100, &cap);
   93     assertEqualInt (status, Ok);
   94     verifyCustomLineCap (cap, LineCapFlat, 100);
   95     GdipDeleteCustomLineCap (cap);
   96 
   97     // Negative tests.
   98     cap = (GpCustomLineCap *) 0xCC;
   99     status = GdipCreateCustomLineCap (NULL, NULL, LineCapRoundAnchor, 10, &cap);
  100     assertEqualInt (status, InvalidParameter);
  101     assert (cap == (GpCustomLineCap *) 0xCC);
  102 
  103     status = GdipCreateCustomLineCap (fillPath, fillPath, LineCapRoundAnchor, 10, NULL);
  104     assertEqualInt (status, InvalidParameter);
  105 
  106     GdipDeletePath (fillPath);
  107     GdipDeletePath (strokePath);
  108 }
  109 
  110 static void test_deleteCustomLineCap ()
  111 {
  112     GpStatus status;
  113     GpCustomLineCap *cap;
  114     GpPath *fillPath;
  115     GpPath *strokePath;
  116 
  117     GdipCreatePath (FillModeAlternate, &fillPath);
  118     GdipCreatePath (FillModeAlternate, &strokePath);
  119     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  120 
  121     status = GdipDeleteCustomLineCap (cap);
  122     assertEqualInt (status, Ok);
  123 
  124     // Negative tests.
  125     status = GdipDeleteCustomLineCap (NULL);
  126     assertEqualInt (status, InvalidParameter);
  127 
  128     GdipDeletePath (fillPath);
  129     GdipDeletePath (strokePath);
  130 }
  131 
  132 static void test_cloneCustomLineCap ()
  133 {
  134     GpStatus status;
  135     GpCustomLineCap *cap;
  136     GpPath *fillPath;
  137     GpPath *strokePath;
  138     GpCustomLineCap *clonedCap;
  139 
  140     GdipCreatePath (FillModeAlternate, &fillPath);
  141     GdipCreatePath (FillModeAlternate, &strokePath);
  142     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  143 
  144     status = GdipCloneCustomLineCap (cap, &clonedCap);
  145     assertEqualInt (status, Ok);
  146     verifyCustomLineCap (clonedCap, LineCapFlat, 10);
  147     GdipDeleteCustomLineCap (clonedCap);
  148 
  149     // Negative tests.
  150     status = GdipCloneCustomLineCap (NULL, &clonedCap);
  151     assertEqualInt (status, InvalidParameter);
  152 
  153     // This causes a null pointer dereference in GDI+.
  154 #if !defined(USE_WINDOWS_GDIPLUS)
  155     status = GdipCloneCustomLineCap (cap, NULL);
  156     assertEqualInt (status, InvalidParameter);
  157 #endif
  158 
  159     GdipDeletePath (fillPath);
  160     GdipDeletePath (strokePath);
  161     GdipDeleteCustomLineCap (cap);
  162 }
  163 
  164 static void test_getCustomLineCapType ()
  165 {
  166     GpStatus status;
  167     GpCustomLineCap *cap;
  168     GpPath *fillPath;
  169     GpPath *strokePath;
  170     CustomLineCapType type;
  171 
  172     GdipCreatePath (FillModeAlternate, &fillPath);
  173     GdipCreatePath (FillModeAlternate, &strokePath);
  174     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  175 
  176     // Negative tests.
  177     status = GdipGetCustomLineCapType (NULL, &type);
  178     assertEqualInt (status, InvalidParameter);
  179 
  180     status = GdipGetCustomLineCapType (cap, NULL);
  181     assertEqualInt (status, InvalidParameter);
  182 
  183     GdipDeletePath (fillPath);
  184     GdipDeletePath (strokePath);
  185     GdipDeleteCustomLineCap (cap);
  186 }
  187 
  188 static void test_setCustomLineCapStrokeCaps ()
  189 {
  190     GpStatus status;
  191     GpCustomLineCap *cap;
  192     GpPath *fillPath;
  193     GpPath *strokePath;
  194     LineCap startCap;
  195     LineCap endCap;
  196 
  197     GdipCreatePath (FillModeAlternate, &fillPath);
  198     GdipCreatePath (FillModeAlternate, &strokePath);
  199     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  200 
  201     // LineCapFlat/LineCapSquare.
  202     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapSquare);
  203     assertEqualInt (status, Ok);
  204 
  205     GdipGetCustomLineCapStrokeCaps (cap, &startCap, &endCap);
  206     assertEqualInt (startCap, LineCapFlat);
  207     assertEqualInt (endCap, LineCapSquare);
  208 
  209     // LineCapSquare/LineCapFlat.
  210     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapSquare, LineCapFlat);
  211     assertEqualInt (status, Ok);
  212 
  213     GdipGetCustomLineCapStrokeCaps (cap, &startCap, &endCap);
  214     assertEqualInt (startCap, LineCapSquare);
  215     assertEqualInt (endCap, LineCapFlat);
  216 
  217     // LineCapRound/LineCapTriangle.
  218     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapRound, LineCapTriangle);
  219     assertEqualInt (status, Ok);
  220 
  221     GdipGetCustomLineCapStrokeCaps (cap, &startCap, &endCap);
  222     assertEqualInt (startCap, LineCapRound);
  223     assertEqualInt (endCap, LineCapTriangle);
  224 
  225     // LineCapTriangle/LineCapRound.
  226     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapTriangle, LineCapRound);
  227     assertEqualInt (status, Ok);
  228 
  229     GdipGetCustomLineCapStrokeCaps (cap, &startCap, &endCap);
  230     assertEqualInt (startCap, LineCapTriangle);
  231     assertEqualInt (endCap, LineCapRound);
  232 
  233     // Same value.
  234     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapTriangle, LineCapRound);
  235     assertEqualInt (status, Ok);
  236 
  237     GdipGetCustomLineCapStrokeCaps (cap, &startCap, &endCap);
  238     assertEqualInt (startCap, LineCapTriangle);
  239     assertEqualInt (endCap, LineCapRound);
  240 
  241     // Negative tests.
  242     status = GdipSetCustomLineCapStrokeCaps (NULL, LineCapArrowAnchor, LineCapFlat);
  243     assertEqualInt (status, InvalidParameter);
  244 
  245     status = GdipSetCustomLineCapStrokeCaps (cap, (LineCap)(LineCapTriangle + 1), LineCapFlat);
  246     assertEqualInt (status, InvalidParameter);
  247 
  248     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapNoAnchor, LineCapFlat);
  249     assertEqualInt (status, InvalidParameter);
  250 
  251     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapSquareAnchor, LineCapFlat);
  252     assertEqualInt (status, InvalidParameter);
  253 
  254     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapRoundAnchor, LineCapFlat);
  255     assertEqualInt (status, InvalidParameter);
  256 
  257     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapDiamondAnchor, LineCapFlat);
  258     assertEqualInt (status, InvalidParameter);
  259 
  260     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapArrowAnchor, LineCapFlat);
  261     assertEqualInt (status, InvalidParameter);
  262 
  263     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapCustom, LineCapFlat);
  264     assertEqualInt (status, InvalidParameter);
  265 
  266     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapAnchorMask, LineCapFlat);
  267     assertEqualInt (status, InvalidParameter);
  268 
  269     status = GdipSetCustomLineCapStrokeCaps (cap, (LineCap)(LineCapCustom + 1), LineCapFlat);
  270     assertEqualInt (status, InvalidParameter);
  271 
  272     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, (LineCap)(LineCapTriangle + 1));
  273     assertEqualInt (status, InvalidParameter);
  274 
  275     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapNoAnchor);
  276     assertEqualInt (status, InvalidParameter);
  277 
  278     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapSquareAnchor);
  279     assertEqualInt (status, InvalidParameter);
  280 
  281     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapRoundAnchor);
  282     assertEqualInt (status, InvalidParameter);
  283 
  284     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapDiamondAnchor);
  285     assertEqualInt (status, InvalidParameter);
  286 
  287     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapArrowAnchor);
  288     assertEqualInt (status, InvalidParameter);
  289 
  290     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapCustom);
  291     assertEqualInt (status, InvalidParameter);
  292 
  293     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, LineCapAnchorMask);
  294     assertEqualInt (status, InvalidParameter);
  295 
  296     status = GdipSetCustomLineCapStrokeCaps (cap, LineCapFlat, (LineCap)(LineCapCustom + 1));
  297     assertEqualInt (status, InvalidParameter);
  298 
  299     // Make sure nothing changed.
  300     GdipGetCustomLineCapStrokeCaps (cap, &startCap, &endCap);
  301     assertEqualInt (startCap, LineCapTriangle);
  302     assertEqualInt (endCap, LineCapRound);
  303 
  304     GdipDeletePath (fillPath);
  305     GdipDeletePath (strokePath);
  306     GdipDeleteCustomLineCap (cap);
  307 }
  308 
  309 static void test_getCustomLineCapStrokeCaps ()
  310 {
  311     GpStatus status;
  312     GpCustomLineCap *cap;
  313     GpPath *fillPath;
  314     GpPath *strokePath;
  315     LineCap startCap;
  316     LineCap endCap;
  317 
  318     GdipCreatePath (FillModeAlternate, &fillPath);
  319     GdipCreatePath (FillModeAlternate, &strokePath);
  320     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  321 
  322     // Negative tests.
  323     status = GdipGetCustomLineCapStrokeCaps (NULL, &startCap, &endCap);
  324     assertEqualInt (status, InvalidParameter);
  325 
  326     status = GdipGetCustomLineCapStrokeCaps (cap, NULL, &endCap);
  327     assertEqualInt (status, InvalidParameter);
  328 
  329     status = GdipGetCustomLineCapStrokeCaps (cap, &startCap, NULL);
  330     assertEqualInt (status, InvalidParameter);
  331 
  332     GdipDeletePath (fillPath);
  333     GdipDeletePath (strokePath);
  334     GdipDeleteCustomLineCap (cap);
  335 }
  336 
  337 static void test_setCustomLineCapStrokeJoin ()
  338 {
  339     GpStatus status;
  340     GpCustomLineCap *cap;
  341     GpPath *fillPath;
  342     GpPath *strokePath;
  343     LineJoin strokeJoin;
  344 
  345     GdipCreatePath (FillModeAlternate, &fillPath);
  346     GdipCreatePath (FillModeAlternate, &strokePath);
  347     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  348 
  349     // LineJoinMiter.
  350     status = GdipSetCustomLineCapStrokeJoin (cap, LineJoinMiter);
  351     assertEqualInt (status, Ok);
  352 
  353     GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
  354     assertEqualInt (strokeJoin, LineJoinMiter);
  355 
  356     // LineJoinMiter.
  357     status = GdipSetCustomLineCapStrokeJoin (cap, LineJoinBevel);
  358     assertEqualInt (status, Ok);
  359 
  360     GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
  361     assertEqualInt (strokeJoin, LineJoinBevel);
  362 
  363     // LineJoinRound.
  364     status = GdipSetCustomLineCapStrokeJoin (cap, LineJoinRound);
  365     assertEqualInt (status, Ok);
  366 
  367     GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
  368     assertEqualInt (strokeJoin, LineJoinRound);
  369 
  370     // LineJoinMiterClipped.
  371     status = GdipSetCustomLineCapStrokeJoin (cap, LineJoinMiterClipped);
  372     assertEqualInt (status, Ok);
  373 
  374     GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
  375     assertEqualInt (strokeJoin, LineJoinMiterClipped);
  376 
  377     // Same value.
  378     status = GdipSetCustomLineCapStrokeJoin (cap, LineJoinMiterClipped);
  379     assertEqualInt (status, Ok);
  380 
  381     GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
  382     assertEqualInt (strokeJoin, LineJoinMiterClipped);
  383 
  384     // Invalid value - negative.
  385     status = GdipSetCustomLineCapStrokeJoin (cap, (LineJoin)(LineJoinMiter - 1));
  386     assertEqualInt (status, Ok);
  387 
  388     GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
  389     assertEqualInt (strokeJoin, (LineJoin)(LineJoinMiter - 1));
  390 
  391     // Invalid value - positive.
  392     status = GdipSetCustomLineCapStrokeJoin (cap, (LineJoin)(LineJoinMiterClipped + 1));
  393     assertEqualInt (status, Ok);
  394 
  395     GdipGetCustomLineCapStrokeJoin (cap, &strokeJoin);
  396     assertEqualInt (strokeJoin, (LineJoin)(LineJoinMiterClipped + 1));
  397 
  398     // Negative tests.
  399     status = GdipSetCustomLineCapStrokeJoin (NULL, LineJoinMiterClipped);
  400     assertEqualInt (status, InvalidParameter);
  401 
  402     GdipDeletePath (fillPath);
  403     GdipDeletePath (strokePath);
  404     GdipDeleteCustomLineCap (cap);
  405 }
  406 
  407 static void test_getCustomLineCapStrokeJoin ()
  408 {
  409     GpStatus status;
  410     GpCustomLineCap *cap;
  411     GpPath *fillPath;
  412     GpPath *strokePath;
  413     LineJoin strokeJoin;
  414 
  415     GdipCreatePath (FillModeAlternate, &fillPath);
  416     GdipCreatePath (FillModeAlternate, &strokePath);
  417     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  418 
  419     // Negative tests.
  420     status = GdipGetCustomLineCapStrokeJoin (NULL, &strokeJoin);
  421     assertEqualInt (status, InvalidParameter);
  422 
  423     status = GdipGetCustomLineCapStrokeJoin (cap, NULL);
  424     assertEqualInt (status, InvalidParameter);
  425 
  426     GdipDeletePath (fillPath);
  427     GdipDeletePath (strokePath);
  428     GdipDeleteCustomLineCap (cap);
  429 }
  430 
  431 static void test_setCustomLineCapBaseCap ()
  432 {
  433     GpStatus status;
  434     GpCustomLineCap *cap;
  435     GpPath *fillPath;
  436     GpPath *strokePath;
  437     LineCap baseCap;
  438 
  439     GdipCreatePath (FillModeAlternate, &fillPath);
  440     GdipCreatePath (FillModeAlternate, &strokePath);
  441     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  442 
  443     // LineCapFlat.
  444     status = GdipSetCustomLineCapBaseCap (cap, LineCapFlat);
  445     assertEqualInt (status, Ok);
  446 
  447     GdipGetCustomLineCapBaseCap (cap, &baseCap);
  448     assertEqualInt (baseCap, LineCapFlat);
  449 
  450     // LineCapSquare.
  451     status = GdipSetCustomLineCapBaseCap (cap, LineCapSquare);
  452     assertEqualInt (status, Ok);
  453 
  454     GdipGetCustomLineCapBaseCap (cap, &baseCap);
  455     assertEqualInt (baseCap, LineCapSquare);
  456 
  457     // LineCapRound.
  458     status = GdipSetCustomLineCapBaseCap (cap, LineCapRound);
  459     assertEqualInt (status, Ok);
  460 
  461     GdipGetCustomLineCapBaseCap (cap, &baseCap);
  462     assertEqualInt (baseCap, LineCapRound);
  463 
  464     // LineCapTriangle.
  465     status = GdipSetCustomLineCapBaseCap (cap, LineCapTriangle);
  466     assertEqualInt (status, Ok);
  467 
  468     GdipGetCustomLineCapBaseCap (cap, &baseCap);
  469     assertEqualInt (baseCap, LineCapTriangle);
  470 
  471     // Same value.
  472     status = GdipSetCustomLineCapBaseCap (cap, LineCapTriangle);
  473     assertEqualInt (status, Ok);
  474 
  475     GdipGetCustomLineCapBaseCap (cap, &baseCap);
  476     assertEqualInt (baseCap, LineCapTriangle);
  477 
  478     // Negative tests.
  479     status = GdipSetCustomLineCapBaseCap (NULL, LineCapFlat);
  480     assertEqualInt (status, InvalidParameter);
  481 
  482     status = GdipSetCustomLineCapBaseCap (cap, (LineCap)(LineCapTriangle + 1));
  483     assertEqualInt (status, InvalidParameter);
  484 
  485     status = GdipSetCustomLineCapBaseCap (cap, LineCapNoAnchor);
  486     assertEqualInt (status, InvalidParameter);
  487 
  488     status = GdipSetCustomLineCapBaseCap (cap, LineCapSquareAnchor);
  489     assertEqualInt (status, InvalidParameter);
  490 
  491     status = GdipSetCustomLineCapBaseCap (cap, LineCapRoundAnchor);
  492     assertEqualInt (status, InvalidParameter);
  493 
  494     status = GdipSetCustomLineCapBaseCap (cap, LineCapDiamondAnchor);
  495     assertEqualInt (status, InvalidParameter);
  496 
  497     status = GdipSetCustomLineCapBaseCap (cap, LineCapArrowAnchor);
  498     assertEqualInt (status, InvalidParameter);
  499 
  500     status = GdipSetCustomLineCapBaseCap (cap, LineCapCustom);
  501     assertEqualInt (status, InvalidParameter);
  502 
  503     status = GdipSetCustomLineCapBaseCap (cap, LineCapAnchorMask);
  504     assertEqualInt (status, InvalidParameter);
  505 
  506     status = GdipSetCustomLineCapBaseCap (cap, (LineCap)(LineCapCustom + 1));
  507     assertEqualInt (status, InvalidParameter);
  508 
  509     // Make sure nothing changed.
  510     GdipGetCustomLineCapBaseCap (cap, &baseCap);
  511     assertEqualInt (baseCap, LineCapTriangle);
  512 
  513     GdipDeletePath (fillPath);
  514     GdipDeletePath (strokePath);
  515     GdipDeleteCustomLineCap (cap);
  516 }
  517 
  518 static void test_getCustomLineCapBaseCap ()
  519 {
  520     GpStatus status;
  521     GpCustomLineCap *cap;
  522     GpPath *fillPath;
  523     GpPath *strokePath;
  524     LineCap baseCap;
  525 
  526     GdipCreatePath (FillModeAlternate, &fillPath);
  527     GdipCreatePath (FillModeAlternate, &strokePath);
  528     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  529 
  530     // Negative tests.
  531     status = GdipGetCustomLineCapBaseCap (NULL, &baseCap);
  532     assertEqualInt (status, InvalidParameter);
  533 
  534     status = GdipGetCustomLineCapBaseCap (cap, NULL);
  535     assertEqualInt (status, InvalidParameter);
  536 
  537     GdipDeletePath (fillPath);
  538     GdipDeletePath (strokePath);
  539     GdipDeleteCustomLineCap (cap);
  540 }
  541 
  542 static void test_setCustomLineCapBaseInset ()
  543 {
  544     GpStatus status;
  545     GpCustomLineCap *cap;
  546     GpPath *fillPath;
  547     GpPath *strokePath;
  548     REAL baseInset;
  549 
  550     GdipCreatePath (FillModeAlternate, &fillPath);
  551     GdipCreatePath (FillModeAlternate, &strokePath);
  552     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  553 
  554     // Positive value.
  555     status = GdipSetCustomLineCapBaseInset (cap, 2);
  556     assertEqualInt (status, Ok);
  557 
  558     GdipGetCustomLineCapBaseInset (cap, &baseInset);
  559     assertEqualFloat (baseInset, 2);
  560 
  561     // Same value.
  562     status = GdipSetCustomLineCapBaseInset (cap, 2);
  563     assertEqualInt (status, Ok);
  564 
  565     GdipGetCustomLineCapBaseInset (cap, &baseInset);
  566     assertEqualFloat (baseInset, 2);
  567 
  568     // Zero value.
  569     status = GdipSetCustomLineCapBaseInset (cap, 0);
  570     assertEqualInt (status, Ok);
  571 
  572     GdipGetCustomLineCapBaseInset (cap, &baseInset);
  573     assertEqualFloat (baseInset, 0);
  574 
  575     // Negative value.
  576     status = GdipSetCustomLineCapBaseInset (cap, -1);
  577     assertEqualInt (status, Ok);
  578 
  579     GdipGetCustomLineCapBaseInset (cap, &baseInset);
  580     assertEqualFloat (baseInset, -1);
  581 
  582     // Negative tests.
  583     status = GdipSetCustomLineCapBaseInset (NULL, 1);
  584     assertEqualInt (status, InvalidParameter);
  585 
  586     GdipDeletePath (fillPath);
  587     GdipDeletePath (strokePath);
  588     GdipDeleteCustomLineCap (cap);
  589 }
  590 
  591 static void test_getCustomLineCapBaseInset ()
  592 {
  593     GpStatus status;
  594     GpCustomLineCap *cap;
  595     GpPath *fillPath;
  596     GpPath *strokePath;
  597     REAL baseInset;
  598 
  599     GdipCreatePath (FillModeAlternate, &fillPath);
  600     GdipCreatePath (FillModeAlternate, &strokePath);
  601     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  602 
  603     // Negative tests.
  604     status = GdipGetCustomLineCapBaseInset (NULL, &baseInset);
  605     assertEqualInt (status, InvalidParameter);
  606 
  607     status = GdipGetCustomLineCapBaseInset (cap, NULL);
  608     assertEqualInt (status, InvalidParameter);
  609 
  610     GdipDeletePath (fillPath);
  611     GdipDeletePath (strokePath);
  612     GdipDeleteCustomLineCap (cap);
  613 }
  614 
  615 static void test_setCustomLineCapWidthScale ()
  616 {
  617     GpStatus status;
  618     GpCustomLineCap *cap;
  619     GpPath *fillPath;
  620     GpPath *strokePath;
  621     REAL widthScale;
  622 
  623     GdipCreatePath (FillModeAlternate, &fillPath);
  624     GdipCreatePath (FillModeAlternate, &strokePath);
  625     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  626 
  627     // Positive value.
  628     status = GdipSetCustomLineCapWidthScale (cap, 2);
  629     assertEqualInt (status, Ok);
  630 
  631     GdipGetCustomLineCapWidthScale (cap, &widthScale);
  632     assertEqualFloat (widthScale, 2);
  633 
  634     // Same value.
  635     status = GdipSetCustomLineCapWidthScale (cap, 2);
  636     assertEqualInt (status, Ok);
  637 
  638     GdipGetCustomLineCapWidthScale (cap, &widthScale);
  639     assertEqualFloat (widthScale, 2);
  640 
  641     // Zero value.
  642     status = GdipSetCustomLineCapWidthScale (cap, 0);
  643     assertEqualInt (status, Ok);
  644 
  645     GdipGetCustomLineCapWidthScale (cap, &widthScale);
  646     assertEqualFloat (widthScale, 0);
  647 
  648     // Negative value.
  649     status = GdipSetCustomLineCapWidthScale (cap, -1);
  650     assertEqualInt (status, Ok);
  651 
  652     GdipGetCustomLineCapWidthScale (cap, &widthScale);
  653     assertEqualFloat (widthScale, -1);
  654 
  655     // Negative tests.
  656     status = GdipSetCustomLineCapWidthScale (NULL, 1);
  657     assertEqualInt (status, InvalidParameter);
  658 
  659     GdipDeletePath (fillPath);
  660     GdipDeletePath (strokePath);
  661     GdipDeleteCustomLineCap (cap);
  662 }
  663 
  664 static void test_getCustomLineCapWidthScale ()
  665 {
  666     GpStatus status;
  667     GpCustomLineCap *cap;
  668     GpPath *fillPath;
  669     GpPath *strokePath;
  670     REAL widthScale;
  671 
  672     GdipCreatePath (FillModeAlternate, &fillPath);
  673     GdipCreatePath (FillModeAlternate, &strokePath);
  674     GdipCreateCustomLineCap (fillPath, strokePath, LineCapDiamondAnchor, 10, &cap);
  675 
  676     // Negative tests.
  677     status = GdipGetCustomLineCapWidthScale (NULL, &widthScale);
  678     assertEqualInt (status, InvalidParameter);
  679 
  680     status = GdipGetCustomLineCapWidthScale (cap, NULL);
  681     assertEqualInt (status, InvalidParameter);
  682 
  683     GdipDeletePath (fillPath);
  684     GdipDeletePath (strokePath);
  685     GdipDeleteCustomLineCap (cap);
  686 }
  687 
  688 int
  689 main(int argc, char**argv)
  690 {
  691     STARTUP;
  692 
  693     test_createCustomLineCap ();
  694     test_deleteCustomLineCap ();
  695     test_cloneCustomLineCap ();
  696     test_getCustomLineCapType ();
  697     test_setCustomLineCapStrokeCaps ();
  698     test_getCustomLineCapStrokeCaps ();
  699     test_setCustomLineCapStrokeJoin ();
  700     test_getCustomLineCapStrokeJoin ();
  701     test_setCustomLineCapBaseCap ();
  702     test_getCustomLineCapBaseCap ();
  703     test_setCustomLineCapBaseInset ();
  704     test_getCustomLineCapBaseInset ();
  705     test_setCustomLineCapWidthScale ();
  706     test_getCustomLineCapWidthScale ();
  707 
  708     SHUTDOWN;
  709     return 0;
  710 }