loaders: Add meta-data clear method and double type.
[gfxprim.git] / tests / common / GP_TestingCore.h
blob31d2d1f2fda18873cbf6768597ba58dea530acb7
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2011 Tomas Gavenciak <gavento@ucw.cz> *
20 * *
21 *****************************************************************************/
23 #ifndef CORE_GP_TESTINGCORE_H
24 #define CORE_GP_TESTINGCORE_H
26 #include "GP_Context.h"
27 #include "GP_Pixel.h"
30 * Return pixel value of random color of given type.
31 * Uses GP_TestingRandom and is not really efficient.
33 GP_Pixel GP_RandomColor(GP_PixelType type);
35 /*
36 * Set color of pixels in given bitap rectangle to random values.
37 * Uses GP_TestingRandom and is not really efficient.
39 void GP_RandomizeRect(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w, GP_Size h);
42 * Return true if the two colors are equal after conversion to RGBA8888.
43 * Not very efficient.
45 int GP_EqualColors(GP_Pixel p1, GP_PixelType t1, GP_Pixel p2, GP_PixelType t2);
48 * Macro version with GP_CHECK
50 #define GP_CHECK_EqualColors(p1, t1, p2, t2) do { \
51 if (!GP_EqualColors(p1, t1, p2, t2)) { \
52 char b1[256], b2[256]; \
53 GP_PixelSNPrint(b1, 256, p1, t1); \
54 GP_PixelSNPrint(b2, 256, p2, t2); \
55 GP_ABORT("Pixels %s and %s are not the same color.", b1, b2); \
56 } } while (0);
59 * Compare two rectangles in two contexts. Return 1 on equal.
60 * The colors are cmpared by first converting them to RGBA8888.
61 * Somewhat inefficient.
63 int GP_EqualRects(const GP_Context *c1, GP_Coord x1, GP_Coord y1, GP_Size w, GP_Size h,
64 const GP_Context *c2, GP_Coord x2, GP_Coord y2);
66 #endif /* CORE_GP_TESTINGCORE_H */