mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-30 00:04:26 -04:00
Synched with QgsProject changes.
git-svn-id: http://svn.osgeo.org/qgis/trunk@2902 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
f56e218dfe
commit
82ae4ea6d7
tests/qgsproject
@ -40,6 +40,7 @@ class ProjectTest : public CppUnit::TestFixture
|
|||||||
CPPUNIT_TEST( testDirtyFlag );
|
CPPUNIT_TEST( testDirtyFlag );
|
||||||
CPPUNIT_TEST( readNullEntries );
|
CPPUNIT_TEST( readNullEntries );
|
||||||
CPPUNIT_TEST( testWriteEntries );
|
CPPUNIT_TEST( testWriteEntries );
|
||||||
|
CPPUNIT_TEST( testXML );
|
||||||
CPPUNIT_TEST( testRemoveEntry );
|
CPPUNIT_TEST( testRemoveEntry );
|
||||||
CPPUNIT_TEST( testClearProperties );
|
CPPUNIT_TEST( testClearProperties );
|
||||||
CPPUNIT_TEST( testEntryList );
|
CPPUNIT_TEST( testEntryList );
|
||||||
@ -58,15 +59,15 @@ class ProjectTest : public CppUnit::TestFixture
|
|||||||
mTitle = "test title";
|
mTitle = "test title";
|
||||||
mScope = "project_test";
|
mScope = "project_test";
|
||||||
|
|
||||||
mNumValueKey = "/values/num";
|
mNumValueKey = "/values/myNum";
|
||||||
|
|
||||||
mDoubleValueKey = "/values/double";
|
mDoubleValueKey = "/values/myDouble";
|
||||||
|
|
||||||
mBoolValueKey = "/values/bool";
|
mBoolValueKey = "/values/myBool";
|
||||||
|
|
||||||
mStringValueKey = "/values/strings/string";
|
mStringValueKey = "/values/myStrings/myString";
|
||||||
|
|
||||||
mStringListValueKey = "/values/strings/stringlist";
|
mStringListValueKey = "/values/myStrings/myStringlist";
|
||||||
|
|
||||||
|
|
||||||
mNumValueConst = 42;
|
mNumValueConst = 42;
|
||||||
@ -185,6 +186,34 @@ class ProjectTest : public CppUnit::TestFixture
|
|||||||
CPPUNIT_ASSERT( QgsProject::instance()->dirty() );
|
CPPUNIT_ASSERT( QgsProject::instance()->dirty() );
|
||||||
|
|
||||||
|
|
||||||
|
bool status;
|
||||||
|
|
||||||
|
int i = QgsProject::instance()->readNumEntry( mScope, mNumValueKey, 13, &status );
|
||||||
|
CPPUNIT_ASSERT( mNumValueConst == i && status );
|
||||||
|
|
||||||
|
bool b = QgsProject::instance()->readBoolEntry( mScope, mBoolValueKey, false, &status );
|
||||||
|
CPPUNIT_ASSERT( mBoolValueConst == b && status );
|
||||||
|
|
||||||
|
double d = QgsProject::instance()->readDoubleEntry( mScope, mDoubleValueKey, 99.0, &status );
|
||||||
|
CPPUNIT_ASSERT( mDoubleValueConst == d && status );
|
||||||
|
|
||||||
|
QString s = QgsProject::instance()->readEntry( mScope, mStringValueKey, "FOO", &status );
|
||||||
|
CPPUNIT_ASSERT( mStringValueConst == s && status );
|
||||||
|
|
||||||
|
QStringList sl = QgsProject::instance()->readListEntry( mScope, mStringListValueKey, &status );
|
||||||
|
CPPUNIT_ASSERT( mStringListValueConst == sl && status );
|
||||||
|
|
||||||
|
} // testWriteEntries
|
||||||
|
|
||||||
|
void testXML()
|
||||||
|
{ // write out the state, clear the project, reload it, and see if we got
|
||||||
|
// everything back
|
||||||
|
CPPUNIT_ASSERT( QgsProject::instance()->write() );
|
||||||
|
|
||||||
|
QgsProject::instance()->clearProperties();
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT( QgsProject::instance()->read() );
|
||||||
|
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
bool b = QgsProject::instance()->readBoolEntry( mScope, mBoolValueKey, false, &status );
|
bool b = QgsProject::instance()->readBoolEntry( mScope, mBoolValueKey, false, &status );
|
||||||
@ -202,8 +231,10 @@ class ProjectTest : public CppUnit::TestFixture
|
|||||||
QStringList sl = QgsProject::instance()->readListEntry( mScope, mStringListValueKey, &status );
|
QStringList sl = QgsProject::instance()->readListEntry( mScope, mStringListValueKey, &status );
|
||||||
CPPUNIT_ASSERT( mStringListValueConst == sl && status );
|
CPPUNIT_ASSERT( mStringListValueConst == sl && status );
|
||||||
|
|
||||||
} // testWriteEntries
|
// qDebug( "%s:%d testXML after read" );
|
||||||
|
|
||||||
|
// QgsProject::instance()->dumpProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void testRemoveEntry()
|
void testRemoveEntry()
|
||||||
@ -325,6 +356,7 @@ class ProjectTest : public CppUnit::TestFixture
|
|||||||
CPPUNIT_ASSERT( entries.find( "five" ) == entries.end() );
|
CPPUNIT_ASSERT( entries.find( "five" ) == entries.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// file name for project file
|
/// file name for project file
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = testproject
|
TARGET = testproject
|
||||||
|
|
||||||
|
INCLUDEPATH += .
|
||||||
|
LIBPATH += $(HOME)/lib
|
||||||
|
|
||||||
|
CONFIG = qt warn_on debug thread exceptions stl rtti
|
||||||
|
|
||||||
# get gdal info
|
# get gdal info
|
||||||
GDAL_LIBS = $$system(gdal-config --libs)
|
GDAL_LIBS = $$system(gdal-config --libs)
|
||||||
@ -24,6 +28,40 @@ QGIS_FILES = qgisapp.o \
|
|||||||
qgsacetatelines.o \
|
qgsacetatelines.o \
|
||||||
qgsacetateobject.o \
|
qgsacetateobject.o \
|
||||||
qgsacetaterectangle.o \
|
qgsacetaterectangle.o \
|
||||||
|
qgscomposer.moc.o \
|
||||||
|
qgscomposerbase.moc.uic.o \
|
||||||
|
qgscomposerbase.uic.o \
|
||||||
|
qgscomposer.o \
|
||||||
|
qgscompositionbase.moc.uic.o \
|
||||||
|
qgscompositionbase.uic.o \
|
||||||
|
qgscomposition.moc.o \
|
||||||
|
qgscomposition.o \
|
||||||
|
qgscomposerview.o \
|
||||||
|
qgscomposerview.moc.o \
|
||||||
|
qgscomposermap.moc.o \
|
||||||
|
qgscomposermapbase.moc.uic.o \
|
||||||
|
qgscomposermap.o \
|
||||||
|
qgscomposermapbase.uic.o \
|
||||||
|
qgscomposervectorlegend.moc.o \
|
||||||
|
qgscomposervectorlegendbase.moc.uic.o \
|
||||||
|
qgscomposervectorlegend.o \
|
||||||
|
qgscomposervectorlegendbase.uic.o \
|
||||||
|
qgscomposerlabel.moc.o \
|
||||||
|
qgscomposerlabelbase.moc.uic.o \
|
||||||
|
qgscomposerlabel.o \
|
||||||
|
qgscomposerlabelbase.uic.o \
|
||||||
|
qgscomposeritem.o \
|
||||||
|
qgsdelattrdialogbase.moc.uic.o \
|
||||||
|
qgsdelattrdialog.moc.o \
|
||||||
|
qgsdelattrdialogbase.uic.o \
|
||||||
|
qgsdelattrdialog.o \
|
||||||
|
qgsattributetabledisplay.moc.o \
|
||||||
|
qgsrunprocess.moc.o \
|
||||||
|
qgsrunprocess.o \
|
||||||
|
qgsaddattrdialogbase.moc.uic.o \
|
||||||
|
qgsaddattrdialog.moc.o \
|
||||||
|
qgsaddattrdialogbase.uic.o \
|
||||||
|
qgsaddattrdialog.o \
|
||||||
qgsattributeaction.o \
|
qgsattributeaction.o \
|
||||||
qgsattributeactiondialog.o \
|
qgsattributeactiondialog.o \
|
||||||
qgsattributedialog.o \
|
qgsattributedialog.o \
|
||||||
@ -48,6 +86,8 @@ QGIS_FILES = qgisapp.o \
|
|||||||
qgsgramaextensionwidget.o \
|
qgsgramaextensionwidget.o \
|
||||||
qgsgrasydialog.o \
|
qgsgrasydialog.o \
|
||||||
qgshelpviewer.o \
|
qgshelpviewer.o \
|
||||||
|
qgsencodingfiledialog.moc.o \
|
||||||
|
qgsencodingfiledialog.o \
|
||||||
qgsidentifyresults.o \
|
qgsidentifyresults.o \
|
||||||
qgslabelattributes.o \
|
qgslabelattributes.o \
|
||||||
qgslabel.o \
|
qgslabel.o \
|
||||||
@ -133,7 +173,6 @@ QGIS_FILES = qgisapp.o \
|
|||||||
qgspgquerybuilder.moc.o \
|
qgspgquerybuilder.moc.o \
|
||||||
qgisapp.moc.o \
|
qgisapp.moc.o \
|
||||||
qgisinterface.moc.o \
|
qgisinterface.moc.o \
|
||||||
qgsattributeaction.moc.o \
|
|
||||||
qgsattributeactiondialog.moc.o \
|
qgsattributeactiondialog.moc.o \
|
||||||
qgsattributedialog.moc.o \
|
qgsattributedialog.moc.o \
|
||||||
qgsattributetable.moc.o \
|
qgsattributetable.moc.o \
|
||||||
@ -160,6 +199,7 @@ QGIS_FILES = qgisapp.o \
|
|||||||
qgsoptions.moc.o \
|
qgsoptions.moc.o \
|
||||||
qgspatterndialog.moc.o \
|
qgspatterndialog.moc.o \
|
||||||
qgspluginmanager.moc.o \
|
qgspluginmanager.moc.o \
|
||||||
|
qgsprojectproperty.o \
|
||||||
qgsprojectproperties.moc.o \
|
qgsprojectproperties.moc.o \
|
||||||
qgsrasterlayer.moc.o \
|
qgsrasterlayer.moc.o \
|
||||||
qgsrasterlayerproperties.moc.o \
|
qgsrasterlayerproperties.moc.o \
|
||||||
@ -205,16 +245,13 @@ QGIS_FILES = qgisapp.o \
|
|||||||
qgspgquerybuilderbase.moc.uic.o
|
qgspgquerybuilderbase.moc.uic.o
|
||||||
|
|
||||||
|
|
||||||
|
# Note that auto(cont|make) and libtool prepend "qgis-" to binary names.
|
||||||
QGIS_OBJS = $$join(QGIS_FILES," ../../src/qgis-"," ../../src/qgis-")
|
QGIS_OBJS = $$join(QGIS_FILES," ../../src/qgis-"," ../../src/qgis-")
|
||||||
|
|
||||||
INCLUDEPATH += .
|
|
||||||
LIBPATH += $(HOME)/lib
|
|
||||||
|
|
||||||
CONFIG += qt warn_on debug thread exceptions stl rtti
|
|
||||||
|
|
||||||
DEFINES = QGISDEBUG
|
DEFINES = QGISDEBUG
|
||||||
|
|
||||||
LIBS += -lcppunit -dl -lqgis $$QGIS_OBJS $$GDAL_LIBS
|
LIBS += -lcppunit -dl $$QGIS_OBJS $$GDAL_LIBS
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
HEADERS += projecttest.h
|
HEADERS += projecttest.h
|
||||||
|
Loading…
x
Reference in New Issue
Block a user