forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbmp_read.py
executable file
·75 lines (55 loc) · 2.35 KB
/
bmp_read.py
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
#!/usr/bin/env pytest
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test basic read support for a all datatypes from a BMP file.
# Author: Andrey Kiselev, [email protected]
#
###############################################################################
# Copyright (c) 2003, Andrey Kiselev <[email protected]>
# Copyright (c) 2008-2009, Even Rouault <even dot rouault at spatialys.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
###############################################################################
import pytest
import gdaltest
init_list = [
('1bit.bmp', 200),
('4bit_pal.bmp', 2587),
('8bit_pal.bmp', 4672),
('byte_rle8.bmp', 4672)]
@pytest.mark.parametrize(
'filename,checksum',
init_list,
ids=[tup[0].split('.')[0] for tup in init_list],
)
@pytest.mark.require_driver('BMP')
def test_bmp_open(filename, checksum):
ut = gdaltest.GDALTest('BMP', filename, 1, checksum)
ut.testOpen()
def test_bmp_online_1():
if not gdaltest.download_file('http://download.osgeo.org/gdal/data/bmp/8bit_pal_rle.bmp', '8bit_pal_rle.bmp'):
pytest.skip()
tst = gdaltest.GDALTest('BMP', 'tmp/cache/8bit_pal_rle.bmp', 1, 17270, filename_absolute=1)
return tst.testOpen()
def test_bmp_online_2():
if not gdaltest.download_file('http://download.osgeo.org/gdal/data/bmp/24bit.bmp', '24bit.bmp'):
pytest.skip()
tst = gdaltest.GDALTest('BMP', 'tmp/cache/24bit.bmp', 1, 7158, filename_absolute=1)
if tst == 'success':
tst = gdaltest.GDALTest('BMP', 'tmp/cache/24bit.bmp', 3, 27670, filename_absolute=1)
return tst.testOpen()