Statistics
| Revision:

root / trunk / libraries / libRaster / src-test / org / gvsig / raster / dataset / io / TestWriterParams.java @ 12128

History | View | Annotate | Download (3.38 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.dataset.io;
20

    
21
import junit.framework.TestCase;
22

    
23
import org.gvsig.raster.RasterLibrary;
24
import org.gvsig.raster.dataset.GeoRasterWriter;
25
import org.gvsig.raster.dataset.NotSupportedExtensionException;
26
import org.gvsig.raster.dataset.Params;
27
import org.gvsig.raster.dataset.RasterDriverException;
28

    
29
/**
30
 * Prueba para la inserci?n y extracci?n de par?metros de los driver de escritura.
31
 * Lee primero los valores asignados en la inicializaci?n y luego hace algunas
32
 * variaciones comprobando que los resultados sean correctos.
33
 * 
34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35
 *
36
 */
37
public class TestWriterParams extends TestCase {
38
        private GeoRasterWriter grw = null;
39
        private Params wp = null;
40
        
41
        public void start() {
42
                this.setUp();
43
                this.testStack();
44
        }
45
        
46
        static {
47
                RasterLibrary.wakeUp();
48
        }
49
        
50
        public void setUp() {
51
                System.err.println("TestWriterParams running...");
52
                //Extensi?n gestionada por gdal
53
                try {
54
                        grw = GeoRasterWriter.getWriter("prueba.tif");
55
                } catch (NotSupportedExtensionException e) {
56
                        e.printStackTrace();
57
                } catch (RasterDriverException e) {
58
                        e.printStackTrace();
59
                }
60
                wp = grw.getParams();
61
        }
62
        
63
        public void testStack(){
64
                String blockSize = wp.getParamById("blocksize").defaultValue;
65
                //String georef = wp.getParamById("georef").defaultValue;
66
                String photometric = wp.getParamById("photometric").defaultValue;
67
                String interleave = wp.getParamById("interleave").defaultValue;
68
                String compression = wp.getParamById("compression").defaultValue;
69
                String tfw = wp.getParamById("tfw").defaultValue;
70
                
71
                assertEquals(blockSize, "512");
72
                //assertEquals(georef, "true");
73
                assertEquals(photometric, "RGB");
74
                assertEquals(interleave, "BAND");
75
                assertEquals(compression, "NONE");
76
                assertEquals(tfw, "false");
77
                
78
                wp.changeParamValue("blocksize", "256");
79
                //wp.changeParamValue("georef", "false");
80
                wp.changeParamValue("photometric", "MINISBLACK");
81
                wp.changeParamValue("interleave", "PIXEL");
82
                wp.changeParamValue("compression", "12");
83
                wp.changeParamValue("tfw", "true");
84
                
85
                blockSize = wp.getParamById("blocksize").defaultValue;
86
                //georef = wp.getParamById("georef").defaultValue;
87
                photometric = wp.getParamById("photometric").defaultValue;
88
                interleave = wp.getParamById("interleave").defaultValue;
89
                compression = wp.getParamById("compression").defaultValue;
90
                tfw = wp.getParamById("tfw").defaultValue;
91
                
92
                assertEquals(blockSize, "256");
93
                //assertEquals(georef, "false");
94
                assertEquals(photometric, "MINISBLACK");
95
                assertEquals(interleave, "PIXEL");
96
                assertEquals(compression, "12");
97
                assertEquals(tfw, "true");
98
        }
99
}