summaryrefslogtreecommitdiff
path: root/testscenarios.c
blob: 88677fc70f356c6f9ad0d1b423d754e2d428d6f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "testscenarios.h"
#include "surface.h"
#include "utils.h"

#include <X11/extensions/Xrender.h>

#include <stdlib.h>
#include <string.h>
#include <assert.h>

TestScenario * create_test_scenarios(Display *disp, Window win, int w, int h, int *number)
{
    TestScenario *scenarios;

    *number = 7;

    scenarios = (TestScenario*)malloc(sizeof(TestScenario) * (*number));
    int currentNumber = 0;
    TestScenario *current = &scenarios[currentNumber++];
    /*********************************/
    current->types = PlainTest;
    current->name  = strdup("Plain");
    current->dst   = xrender_surf_adopt(disp, win,  w, h);
    current->mask  = 0;
    current->src   = xrender_surf_new(disp, win, PictStandardRGB24, 128, 128, False);
    populate_from_file(disp, current->dst, "images/bg1.png");
    populate_from_file(disp, current->src, "images/xorg-small.png");


    current = &scenarios[currentNumber++];
    /*********************************/
    current->types = PlainTest | AlphaTest;
    current->name  = strdup("Plain With Alpha");
    current->dst   = xrender_surf_adopt(disp, win, w, h);
    current->mask  = 0;
    current->src   = xrender_surf_new(disp, win,PictStandardARGB32, 128, 128, False);
    populate_from_file(disp, current->src,  "images/xorg-small.png");

    current = &scenarios[currentNumber++];
    /*********************************/
    current->types = PlainTest | AlphaTest | MaskTest;
    current->name  = strdup("Plain With Alpha And Mask");
    current->dst   = xrender_surf_adopt(disp, win, w, h);
    current->mask  = xrender_surf_new(disp, win,PictStandardARGB32, 128, 128, False);
    current->src   = xrender_surf_new(disp, win,PictStandardARGB32, 128, 128, False);
    populate_from_file(disp, current->mask, "images/mask.png");
    populate_from_file(disp, current->src,  "images/xorg-small.png");

    current = &scenarios[currentNumber++];
    /*********************************/
    current->types = PlainTest | AlphaTest | MaskTest;
    current->name  = strdup("Plain With Alpha And CA Mask");
    current->dst   = xrender_surf_adopt(disp, win, w, h);
    current->mask  = xrender_surf_new(disp, win,PictStandardARGB32, 128, 128, True);
    current->src   = xrender_surf_new(disp, win,PictStandardARGB32, 128, 128, False);
    populate_from_file(disp, current->mask, "images/mask.png");
    populate_from_file(disp, current->src,  "images/xorg-small.png");

    current = &scenarios[currentNumber++];
    /*********************************/
    current->types = TransformationTest;
    current->name  = strdup("Transformation");
    current->dst   = xrender_surf_adopt(disp, win, w, h);
    current->mask  = 0;
    current->src   = xrender_surf_new(disp, win, PictStandardRGB24,
                                     128, 128, False);
    populate_from_file(disp, current->src, "images/xorg-small.png");
    xrender_surf_prepare(disp, current->src, current->src->w, current->src->h, 1,
                         SurfaceNone);

    current = &scenarios[currentNumber++];
    /*********************************/
    current->types = TransformationTest | FilterTest;
    current->name  = strdup("Transformation/Bilinear filter");
    current->dst   = xrender_surf_adopt(disp, win, w, h);
    current->mask  = 0;
    current->src   = xrender_surf_new(disp, win, PictStandardRGB24, 128, 128, False);
    populate_from_file(disp, current->src, "images/xorg-small.png");
    xrender_surf_prepare(disp, current->src, current->src->w, current->src->h, 1,
                         SurfaceBilinear);

    current = &scenarios[currentNumber++];
    /*********************************/
    current->types = ConvolutionTest;
    current->name  = strdup("Convolution");
    current->dst   = xrender_surf_adopt(disp, win, w, h);
    current->mask  = 0;
    current->src   = xrender_surf_new(disp, win, PictStandardARGB32, 128, 128, False);
    populate_from_file(disp, current->src, "images/xorg-small.png");
    xrender_surf_prepare(disp, current->src, current->src->w, current->src->h, 0,
                         SurfaceConvolution);

    assert(*number == currentNumber);
    return scenarios;
}