Skip to content

Commit b8ecbb2

Browse files
committed
Tests from the image crate to be sure we don’t break them
1 parent e180921 commit b8ecbb2

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

tests/image.rs

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#[macro_use] extern crate enum_primitive;
2+
3+
mod gif {
4+
enum_from_primitive! {
5+
/// Known block types
6+
enum Block {
7+
Image = 0x2C,
8+
Extension = 0x21,
9+
Trailer = 0x3B
10+
}
11+
}
12+
13+
enum_from_primitive! {
14+
/// Known GIF extensions
15+
enum Extension {
16+
Text = 0x01,
17+
Control = 0xF9,
18+
Comment = 0xFE,
19+
Application = 0xFF
20+
}
21+
}
22+
23+
enum_from_primitive! {
24+
/// Method to dispose the image
25+
enum DisposalMethod {
26+
Undefined = 0,
27+
None = 1,
28+
Previous = 2,
29+
Background = 3
30+
}
31+
}
32+
}
33+
34+
mod png {
35+
enum_from_primitive! {
36+
#[derive(Clone, Copy, Debug, PartialEq)]
37+
enum InterlaceMethod {
38+
None = 0,
39+
Adam7 = 1
40+
}
41+
}
42+
43+
enum_from_primitive! {
44+
#[derive(Debug)]
45+
pub enum FilterType {
46+
NoFilter = 0,
47+
Sub = 1,
48+
Up = 2,
49+
Avg = 3,
50+
Paeth = 4
51+
}
52+
}
53+
}
54+
55+
mod tiff {
56+
enum_from_primitive! {
57+
#[derive(Clone, Copy, Debug, PartialEq)]
58+
enum PhotometricInterpretation {
59+
WhiteIsZero = 0,
60+
BlackIsZero = 1,
61+
RGB = 2,
62+
RGBPalette = 3,
63+
TransparencyMask = 4,
64+
CMYK = 5,
65+
YCbCr = 6,
66+
CIELab = 8,
67+
}
68+
}
69+
70+
enum_from_primitive! {
71+
#[derive(Clone, Copy, Debug)]
72+
enum CompressionMethod {
73+
None = 1,
74+
Huffman = 2,
75+
Fax3 = 3,
76+
Fax4 = 4,
77+
LZW = 5,
78+
JPEG = 6,
79+
PackBits = 32773
80+
}
81+
}
82+
83+
enum_from_primitive! {
84+
#[derive(Clone, Copy, Debug)]
85+
enum PlanarConfiguration {
86+
Chunky = 1,
87+
Planar = 2
88+
}
89+
}
90+
91+
enum_from_primitive! {
92+
#[derive(Clone, Copy, Debug)]
93+
enum Predictor {
94+
None = 1,
95+
Horizontal = 2
96+
}
97+
}
98+
99+
enum_from_primitive! {
100+
#[derive(Clone, Copy, Debug)]
101+
pub enum Type {
102+
BYTE = 1,
103+
ASCII = 2,
104+
SHORT = 3,
105+
LONG = 4,
106+
RATIONAL = 5,
107+
}
108+
}
109+
}

0 commit comments

Comments
 (0)