-
Notifications
You must be signed in to change notification settings - Fork 85
/
testcase.php
137 lines (129 loc) · 4.52 KB
/
testcase.php
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
namespace Dominant_Color_Image\Tests;
use WP_UnitTestCase;
abstract class TestCase extends WP_UnitTestCase {
/**
* Data provider for test_get_dominant_color_GD.
*
* @return array
*/
public function provider_get_dominant_color() {
return array(
'animated_gif' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/animated.gif',
'expected_color' => array( '874e4e', '864e4e', 'df7f7f' ),
'expected_transparency' => true,
),
'red_jpg' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.jpg',
'expected_color' => array( 'ff0000', 'fe0000' ),
'expected_transparency' => false,
),
'green_jpg' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.jpg',
'expected_color' => array( '00ff00', '00ff01', '02ff01' ),
'expected_transparency' => false,
),
'white_jpg' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.jpg',
'expected_color' => array( 'ffffff' ),
'expected_transparency' => false,
),
'red_gif' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.gif',
'expected_color' => array( 'ff0000' ),
'expected_transparency' => false,
),
'green_gif' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.gif',
'expected_color' => array( '00ff00' ),
'expected_transparency' => false,
),
'white_gif' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.gif',
'expected_color' => array( 'ffffff' ),
'expected_transparency' => false,
),
'trans_gif' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/trans.gif',
'expected_color' => array( '5a5a5a', '020202' ),
'expected_transparency' => true,
),
'red_png' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.png',
'expected_color' => array( 'ff0000' ),
'expected_transparency' => false,
),
'green_png' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.png',
'expected_color' => array( '00ff00' ),
'expected_transparency' => false,
),
'white_png' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.png',
'expected_color' => array( 'ffffff' ),
'expected_transparency' => false,
),
'trans_png' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/trans.png',
'expected_color' => array( '000000' ),
'expected_transparency' => true,
),
'red_webp' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.webp',
'expected_color' => array( 'ff0000' ),
'expected_transparency' => false,
),
'green_webp' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.webp',
'expected_color' => array( '00ff00' ),
'expected_transparency' => false,
),
'white_webp' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.webp',
'expected_color' => array( 'ffffff' ),
'expected_transparency' => false,
),
'trans_webp' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/trans.webp',
'expected_color' => array( '000000' ),
'expected_transparency' => true,
),
'balloons_webp' => array(
'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/balloons.webp',
'expected_color' => array( 'c1bbb9', 'c0bbb9', 'c0bab8', 'c3bdbd', 'bfbab8' ),
'expected_transparency' => false,
),
);
}
/**
* Data provider for test_get_dominant_color_GD.
*
* @return array
*/
public function provider_get_dominant_color_invalid_images() {
return array(
'tiff' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/test-image.tiff',
),
'bmp' => array(
'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/test-image.bmp',
),
);
}
/**
* Data provider for test_get_dominant_color_GD.
*
* @return array
*/
public function provider_get_dominant_color_none_images() {
return array(
'pdf' => array(
'files_path' => TESTS_PLUGIN_DIR . '/tests/data/images/wordpress-gsoc-flyer.pdf',
),
'mp4' => array(
'files_path' => TESTS_PLUGIN_DIR . '/tests/data/images/small-video.mp4',
),
);
}
}