Skip to content
Permalink
Browse files

backport test fixes (grass & delimited text provider)

  • Loading branch information
jef-n committed Jul 19, 2015
1 parent 15e5cf0 commit 166bcd462a5a7899c6ca6c86ac62543dba5b6e9a
@@ -20,6 +20,7 @@

#include <QtGlobal>
#include <QFile>
#include <QFileInfo>
#include <QDataStream>
#include <QTextStream>
#include <QFileSystemWatcher>
@@ -840,7 +841,6 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QString &buffer,

bool QgsDelimitedTextFile::isValid()
{

return mDefinitionValid && QFile::exists( mFileName );
return mDefinitionValid && QFile::exists( mFileName ) && QFileInfo( mFileName ).size() > 0;
}

@@ -29,6 +29,7 @@
#include <string.h>
#include <math.h>
#include <assert.h>
#include <limits.h>
#ifdef WIN32
#include <fcntl.h>
#include <io.h>
@@ -255,8 +256,7 @@ static int cell_draw( char *name,
// see comments in QgsGrassRasterProvider::noDataValue()
if ( data_type == CELL_TYPE )
{
//int nul = -2000000000;
int nul = -2147483648;
int nul = INT_MIN;
fwrite( &nul, 4, 1, fo );
}
else if ( data_type == DCELL_TYPE )
@@ -333,7 +333,11 @@ void GRASS_LIB_EXPORT QgsGrass::init( void )

#ifdef Q_OS_WIN
// Use the applicationDirPath()/grass
gisBase = shortPath( QCoreApplication::applicationDirPath() + "/grass" );
#ifdef _MSC_VER
gisBase = shortPath( QCoreApplication::applicationDirPath() + ( QgsApplication::isRunningFromBuildDir() ? + "/../.." : "" ) + "/grass" );
#else
gisBase = shortPath( QCoreApplication::applicationDirPath() + ( QgsApplication::isRunningFromBuildDir() ? + "/.." : "" ) + "/grass" );
#endif
QgsDebugMsg( QString( "GRASS gisBase = %1" ).arg( gisBase ) );
#elif defined(Q_OS_MACX)
// check for bundled GRASS, fall back to configured path
@@ -380,7 +384,7 @@ void GRASS_LIB_EXPORT QgsGrass::init( void )
userGisbase = false;
break;
}
#ifdef Q_OS_WIN32
#ifdef Q_OS_WIN
gisBase = shortPath( gisBase );
#endif
}
@@ -1692,7 +1696,7 @@ QString GRASS_LIB_EXPORT QgsGrass::getInfo( const QString& info, const QString&

QStringList arguments;

QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.g.info";
QString cmd = qgisGrassModulePath() + "/qgis.g.info";

arguments.append( "info=" + info );
if ( !map.isEmpty() )
@@ -2200,7 +2204,7 @@ QString GRASS_LIB_EXPORT QgsGrass::versionString()

Qt::CaseSensitivity GRASS_LIB_EXPORT QgsGrass::caseSensitivity()
{
#ifdef WIN32
#ifdef Q_OS_WIN
return Qt::CaseInsensitive;
#else
return Qt::CaseSensitive;
@@ -2250,7 +2254,7 @@ struct Map_info GRASS_LIB_EXPORT *QgsGrass::vectNewMapStruct()
// may have different sizes of types, see issue #13002. Because there is no Vect_new_map_struct (GRASS 7.0.0, July 2015)
// the structure is allocated here using doubled (should be enough) space.
// TODO: replace by Vect_new_map_struct once it appears in GRASS
#if defined(WIN32)
#ifdef Q_OS_WIN
return ( struct Map_info* ) qgsMalloc( 2*sizeof( struct Map_info ) );
#else
return ( struct Map_info* ) qgsMalloc( sizeof( struct Map_info ) );
@@ -147,7 +147,7 @@ class QgsGrass
};

//! Get info about the mode
/*! QgsGrass may be running in active or passive mode.
/** QgsGrass may be running in active or passive mode.
* Active mode means that GISRC is set up and GISRC file is available,
* in that case default GISDBASE, LOCATION and MAPSET may be read by GetDefaul*() functions.
* Passive mode means, that GISRC is not available. */
@@ -409,12 +409,21 @@ class QgsGrass
// set environment variable
static GRASS_LIB_EXPORT void putEnv( QString name, QString value );

#if defined(WIN32)
#ifdef Q_OS_WIN
static GRASS_LIB_EXPORT QString shortPath( const QString &path );
#endif

// path to QGIS GRASS modules like qgis.g.info etc.
static GRASS_LIB_EXPORT QString qgisGrassModulePath() { return QgsApplication::libexecPath() + "grass/modules"; }
static GRASS_LIB_EXPORT QString qgisGrassModulePath()
{
#ifdef _MSC_VER
if ( QgsApplication::isRunningFromBuildDir() )
{
return QCoreApplication::applicationDirPath() + "/../../grass/modules/" + QgsApplication::cfgIntDir();
}
#endif
return QgsApplication::libexecPath() + "grass/modules";
}

// Allocate struct Map_info
static GRASS_LIB_EXPORT struct Map_info * vectNewMapStruct();
@@ -108,7 +108,7 @@ QgsGrassRasterProvider::QgsGrassRasterProvider( QString const & uri )
double myInternalNoDataValue;
if ( mGrassDataType == CELL_TYPE )
{
myInternalNoDataValue = -2147483648;
myInternalNoDataValue = INT_MIN;
}
else if ( mGrassDataType == DCELL_TYPE )
{
@@ -26,8 +26,11 @@ MACRO (ADD_QGIS_GRASS_TEST grass_build_version testname testsrc)
IF(WIN32 AND NOT USING_NMAKE)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${testname}.cmake
"
SET(ENV{PATH} \"${GRASS_PREFIX${grass_build_version}}/lib;${CMAKE_BINARY_DIR}/output/bin/\${CMAKE_BUILD_TYPE};${CMAKE_BINARY_DIR}/output/plugins/\${CMAKE_BUILD_TYPE};\$ENV{PATH}\")
SET(ENV{PATH} \"${GRASS_PREFIX${grass_build_version}}/bin;${GRASS_PREFIX${grass_build_version}}/lib;${CMAKE_BINARY_DIR}/output/bin/\${CMAKE_BUILD_TYPE};${CMAKE_BINARY_DIR}/output/plugins/\${CMAKE_BUILD_TYPE};\$ENV{PATH}\")
SET(ENV{GISBASE} \"${GRASS_PREFIX${grass_build_version}}\")
MESSAGE(STATUS \"Running ${CMAKE_BINARY_DIR}/output/bin/\${CMAKE_BUILD_TYPE}/qgis_${testname}${grass_build_version}\")
MESSAGE(STATUS \"PATH:\$ENV{PATH}\")
MESSAGE(STATUS \"GISBASE:\$ENV{GISBASE}\")
EXECUTE_PROCESS(
COMMAND ${CMAKE_BINARY_DIR}/output/bin/\${CMAKE_BUILD_TYPE}/qgis_${testname}${grass_build_version}
RESULT_VARIABLE import_res

0 comments on commit 166bcd4

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