mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05: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
@ -40,6 +40,7 @@ class ProjectTest : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST( testDirtyFlag );
|
||||
CPPUNIT_TEST( readNullEntries );
|
||||
CPPUNIT_TEST( testWriteEntries );
|
||||
CPPUNIT_TEST( testXML );
|
||||
CPPUNIT_TEST( testRemoveEntry );
|
||||
CPPUNIT_TEST( testClearProperties );
|
||||
CPPUNIT_TEST( testEntryList );
|
||||
@ -58,15 +59,15 @@ class ProjectTest : public CppUnit::TestFixture
|
||||
mTitle = "test title";
|
||||
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;
|
||||
@ -185,6 +186,34 @@ class ProjectTest : public CppUnit::TestFixture
|
||||
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 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 );
|
||||
CPPUNIT_ASSERT( mStringListValueConst == sl && status );
|
||||
|
||||
} // testWriteEntries
|
||||
// qDebug( "%s:%d testXML after read" );
|
||||
|
||||
// QgsProject::instance()->dumpProperties();
|
||||
}
|
||||
|
||||
|
||||
void testRemoveEntry()
|
||||
@ -325,6 +356,7 @@ class ProjectTest : public CppUnit::TestFixture
|
||||
CPPUNIT_ASSERT( entries.find( "five" ) == entries.end() );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/// file name for project file
|
||||
|
@ -5,6 +5,10 @@
|
||||
TEMPLATE = app
|
||||
TARGET = testproject
|
||||
|
||||
INCLUDEPATH += .
|
||||
LIBPATH += $(HOME)/lib
|
||||
|
||||
CONFIG = qt warn_on debug thread exceptions stl rtti
|
||||
|
||||
# get gdal info
|
||||
GDAL_LIBS = $$system(gdal-config --libs)
|
||||
@ -24,7 +28,41 @@ QGIS_FILES = qgisapp.o \
|
||||
qgsacetatelines.o \
|
||||
qgsacetateobject.o \
|
||||
qgsacetaterectangle.o \
|
||||
qgsattributeaction.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 \
|
||||
qgsattributeactiondialog.o \
|
||||
qgsattributedialog.o \
|
||||
qgsattributetable.o \
|
||||
@ -48,7 +86,9 @@ QGIS_FILES = qgisapp.o \
|
||||
qgsgramaextensionwidget.o \
|
||||
qgsgrasydialog.o \
|
||||
qgshelpviewer.o \
|
||||
qgsidentifyresults.o \
|
||||
qgsencodingfiledialog.moc.o \
|
||||
qgsencodingfiledialog.o \
|
||||
qgsidentifyresults.o \
|
||||
qgslabelattributes.o \
|
||||
qgslabel.o \
|
||||
qgslabeldialog.o \
|
||||
@ -133,7 +173,6 @@ QGIS_FILES = qgisapp.o \
|
||||
qgspgquerybuilder.moc.o \
|
||||
qgisapp.moc.o \
|
||||
qgisinterface.moc.o \
|
||||
qgsattributeaction.moc.o \
|
||||
qgsattributeactiondialog.moc.o \
|
||||
qgsattributedialog.moc.o \
|
||||
qgsattributetable.moc.o \
|
||||
@ -160,6 +199,7 @@ QGIS_FILES = qgisapp.o \
|
||||
qgsoptions.moc.o \
|
||||
qgspatterndialog.moc.o \
|
||||
qgspluginmanager.moc.o \
|
||||
qgsprojectproperty.o \
|
||||
qgsprojectproperties.moc.o \
|
||||
qgsrasterlayer.moc.o \
|
||||
qgsrasterlayerproperties.moc.o \
|
||||
@ -205,16 +245,13 @@ QGIS_FILES = qgisapp.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-")
|
||||
|
||||
INCLUDEPATH += .
|
||||
LIBPATH += $(HOME)/lib
|
||||
|
||||
CONFIG += qt warn_on debug thread exceptions stl rtti
|
||||
|
||||
DEFINES = QGISDEBUG
|
||||
|
||||
LIBS += -lcppunit -dl -lqgis $$QGIS_OBJS $$GDAL_LIBS
|
||||
LIBS += -lcppunit -dl $$QGIS_OBJS $$GDAL_LIBS
|
||||
|
||||
# Input
|
||||
HEADERS += projecttest.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user