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
  
START_MARKER 
 
test_do(add_constant("GIF",MIME.decode_base64("R0lGODlhAQACAIAAAAAAAAAAACwAAAAAAQACAAACAgQKADs="))) 
test_do(add_constant("PNG",MIME.decode_base64("iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAIAAAAW4yFwAAAAC0lEQVR42mNggAAAAAgAAST8BHIAAAAASUVORK5CYII="))) 
test_do(add_constant("JPEG",MIME.decode_base64("/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAACAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAj/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AJ/AB//Z"))) 
test_do(add_constant("WebP_lossy",MIME.decode_base64("UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAIAAgA0JaQAA3AA/vv9UAA="))) 
test_do(add_constant("WebP_lossless",MIME.decode_base64("UklGRhoAAABXRUJQVlA4TA4AAAAvAEAAAAcQEf0PRET/Aw=="))) 
test_do(add_constant("WebP_alpha",MIME.decode_base64("UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAQAAQUxQSAsAAAABBxAREYiI/gcAAABWUDggGAAAADABAJ0BKgEAAgACADQlpAADcAD++/1QAA=="))) 
 
test_equal( Image.Dims.get(GIF), ({ 1, 2, "gif" }) ) 
test_equal( Image.Dims.get_GIF(Stdio.FakeFile(GIF)), ({ 1, 2 }) ) 
test_false( Image.Dims.get_GIF(Stdio.FakeFile(PNG)) ) 
 
test_equal( Image.Dims.get(PNG), ({ 1, 2, "png" }) ) 
test_equal( Image.Dims.get_PNG(Stdio.FakeFile(PNG)), ({ 1, 2 }) ) 
test_false( Image.Dims.get_PNG(Stdio.FakeFile(GIF)) ) 
 
test_equal( Image.Dims.get(JPEG), ({ 1, 2, "jpeg" }) ) 
test_equal( Image.Dims.get_JPEG(Stdio.FakeFile(JPEG)), ({ 1, 2 }) ) 
test_false( Image.Dims.get_JPEG(Stdio.FakeFile(GIF)) ) 
 
test_equal( Image.Dims.get(WebP_lossy), ({ 1, 2, "webp" }) ) 
test_equal( Image.Dims.get(WebP_lossless), ({ 1, 2, "webp" }) ) 
test_equal( Image.Dims.get(WebP_alpha), ({ 1, 2, "webp" }) ) 
test_equal( Image.Dims.get_WebP(Stdio.FakeFile(WebP_lossy)), ({ 1, 2 }) ) 
test_equal( Image.Dims.get_WebP(Stdio.FakeFile(WebP_lossless)), ({ 1, 2 }) ) 
test_equal( Image.Dims.get_WebP(Stdio.FakeFile(WebP_alpha)), ({ 1, 2 }) ) 
test_false( Image.Dims.get_WebP(Stdio.FakeFile(GIF)) ) 
 
 
test_do([[ 
  add_constant("GIF"); 
  add_constant("PNG"); 
  add_constant("JPEG"); 
  add_constant("WebP_lossy"); 
  add_constant("WebP_lossless"); 
  add_constant("WebP_alpha"); 
]]) 
 
dnl Missing test for JPEG with EXIF rotation data. 
dnl Missing test for TIFF in both byte orders. 
dnl Missing test for PSD 
 
END_MARKER