Changeset 12300

Show
Ignore:
Timestamp:
10/03/07 00:20:26 (1 year ago)
Author:
warmerdam
Message:

add #1109 related overview addition test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/autotest/gdrivers/hfa.py

    r11541 r12300  
    381381  
    382382############################################################################### 
     383# Verify we can grow the RRD list in cases where this requires 
     384# moving the HFAEntry to the end of the file.  (bug #1109) 
     385 
     386def hfa_grow_rrdlist(): 
     387 
     388    # copy work file to tmp directory. 
     389    open('tmp/bug_1109.img','w').write(open('data/bug_1109.img').read()) 
     390 
     391    # Add two overview levels. 
     392    ds = gdal.Open('tmp/bug_1109.img',gdal.GA_Update) 
     393    result = ds.BuildOverviews( overviewlist = [4,8] ) 
     394    ds = None 
     395 
     396    if result != 0: 
     397        gdaltest.post_reason( 'BuildOverviews failed.' ) 
     398        return 'fail' 
     399 
     400    # Verify overviews are now findable. 
     401    ds = gdal.Open( 'tmp/bug_1109.img' ) 
     402    if ds.GetRasterBand(1).GetOverviewCount() != 3: 
     403        gdaltest.post_reason( 'Overview count wrong.' ) 
     404        print ds.GetRasterBand(1).GetOverviewCount() 
     405        return 'fail' 
     406 
     407    ds = None 
     408    gdal.GetDriverByName('HFA').Delete( 'tmp/bug_1109.img' ) 
     409     
     410    return 'success' 
     411  
     412############################################################################### 
    383413# 
    384414 
     
    395425    hfa_pe_write, 
    396426    hfa_metadata_1, 
    397     hfa_metadata_2] 
     427    hfa_metadata_2, 
     428    hfa_grow_rrdlist ] 
    398429 
    399430if __name__ == '__main__':