| | 158 | ############################################################################### |
|---|
| | 159 | # Verify ability to open file with corrupt metadata (#1904). Note the file |
|---|
| | 160 | # data/vophead.jpg is truncated to keep the size small, but this should |
|---|
| | 161 | # not affect opening the file which just reads the header. |
|---|
| | 162 | |
|---|
| | 163 | def jpeg_6(): |
|---|
| | 164 | |
|---|
| | 165 | ds = gdal.Open('data/vophead.jpg') |
|---|
| | 166 | |
|---|
| | 167 | # Did we get an exif related warning? |
|---|
| | 168 | if gdal.GetLastErrorType() != 2 \ |
|---|
| | 169 | or string.find(gdal.GetLastErrorMsg(),'Ignoring EXIF') == -1: |
|---|
| | 170 | gdaltest.post_reason( 'we did not get expected error.') |
|---|
| | 171 | return 'fail' |
|---|
| | 172 | |
|---|
| | 173 | md = ds.GetMetadata() |
|---|
| | 174 | if len(md) != 1 or md['EXIF_Software'] != 'IrfanView': |
|---|
| | 175 | gdaltest.post_reason( 'did not get expected metadata.' ) |
|---|
| | 176 | print md |
|---|
| | 177 | return 'fail' |
|---|
| | 178 | |
|---|
| | 179 | ds = None |
|---|
| | 180 | |
|---|
| | 181 | return 'success' |
|---|
| | 182 | |
|---|