Skip to content
Permalink
Browse files

[processing] add unittest for gdal2xyz algorithm

(cherry picked from commit f447745)
  • Loading branch information
alexbruy committed Jan 1, 2019
1 parent e39fdd5 commit 29ee8936f08b773362831811c816f062c24d9d0b
@@ -61,6 +61,7 @@
from processing.algs.gdal.rearrange_bands import rearrange_bands
from processing.algs.gdal.gdaladdo import gdaladdo
from processing.algs.gdal.sieve import sieve
from processing.algs.gdal.gdal2xyz import gdal2xyz

from processing.tools.system import isWindows

@@ -2514,6 +2515,38 @@ def testSieve(self):
source + ' ' +
outsource])

def testGdal2Xyz(self):
context = QgsProcessingContext()
feedback = QgsProcessingFeedback()
source = os.path.join(testDataPath, 'dem.tif')

with tempfile.TemporaryDirectory() as outdir:
outsource = outdir + '/check.csv'
alg = gdal2xyz()
alg.initAlgorithm()

# defaults
self.assertEqual(
alg.getConsoleCommands({'INPUT': source,
'BAND': 1,
'CSV': False,
'OUTPUT': outsource}, context, feedback),
['gdal2xyz.py',
'-band 1 ' +
source + ' ' +
outsource])

# csv output
self.assertEqual(
alg.getConsoleCommands({'INPUT': source,
'BAND': 1,
'CSV': True,
'OUTPUT': outsource}, context, feedback),
['gdal2xyz.py',
'-band 1 -csv ' +
source + ' ' +
outsource])


class TestGdalOgrToPostGis(unittest.TestCase):

@@ -167,20 +167,6 @@ tests:
- 'Band 1 Block=373x5 Type=Float32, ColorInterp=Gray'
- ' NoData Value=-99999'

# Disabled as gdal2xyz.py is not available on Travis
# - algorithm: gdal:gdal2xyz
# name: gdal2xyz
# params:
# BAND: 1
# CSV: false
# INPUT:
# name: dem.tif
# type: raster
# results:
# OUTPUT:
# name: expected/gdal/xyz.csv
# type: file

- algorithm: gdal:tileindex
name: Tile index (gdaltindex)
params:

0 comments on commit 29ee893

Please sign in to comment.
You can’t perform that action at this time.