Skip to content
Permalink
Browse files

More clean ups to test builder - warnning it will damge the local mak…

…efile if used at teh moment.

Added a test class for qgssymbol - which fails when run
Add rules to makefile to build symbol test


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5221 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Apr 8, 2006
1 parent fc66e43 commit 6f089dc464774e8eb7084ba8e981497fc8639630
Showing with 47 additions and 14 deletions.
  1. +8 −2 tests/src/core/Makefile.am
  2. +13 −12 tests/src/core/test_builder.pl
  3. +26 −0 tests/src/core/testqgssymbol.cpp
@@ -8,7 +8,8 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bin_PROGRAMS = testqgsapplication
bin_PROGRAMS = testqgsapplication \
testqgssymbol

#
# Define some global variables that will be used for building each test
@@ -24,7 +25,8 @@ GLOBALCXXFLAGS = $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(GDAL_CFLAGS) $(QT_CXXFLAGS) $(P
%.moc.cpp: %.cpp
$(MOC) -o $@ $<

BUILT_SOURCES = $(testqgsapplication_MOC)
BUILT_SOURCES = $(testqgsapplication_MOC) \
$(testqgssymbol_MOC)

CLEANFILES = $(BUILT_SOURCES)

@@ -38,3 +40,7 @@ testqgsapplication_LDADD = $(GLOBALLDADD)
testqgsapplication_CXXFLAGS = $(GLOBALCXXFLAGS)


testqgssymbol_MOC = testqgssymbol.moc.cpp
testqgssymbol_SOURCES = testqgssymbol.cpp
testqgssymbol_LDADD = $(GLOBALLDADD)
testqgssymbol_CXXFLAGS = $(GLOBALCXXFLAGS)
@@ -39,7 +39,7 @@
# its a go -- create the unit test and modify the build files
#
system("cp test_template.cpp test$testClassLowerCaseName.cpp");

# Substitute the class name in the file
system("perl -pi -e 's/\\\[testClassLowerCaseName\\\]/$testClassLowerCaseName/g' test$testClassLowerCaseName.cpp");
system("perl -pi -e 's/\\\[testClassCamelCaseName\\\]/$testClass/g' test$testClassLowerCaseName.cpp");
@@ -76,31 +76,32 @@
}
}
#before closing the file add the lines for our new test class
print MAKEFILEMOD "test${testClassLowerCaseName}_MOC = test${testClassLowerCaseName}.moc.cpp"
print MAKEFILEMOD "test${testClassLowerCaseName}_SOURCES = ${testClassLowerCaseName}.cpp"
print MAKEFILEMOD "test${testClassLowerCaseName}_LDADD = $(GLOBALLDADD)"
print MAKEFILEMOD "test${testClassLowerCaseName}_CXXFLAGS = $(GLOBALCXXFLAGS)"
print MAKEFILEMOD "test${testClassLowerCaseName}_MOC = test${testClassLowerCaseName}.moc.cpp";
print MAKEFILEMOD "test${testClassLowerCaseName}_SOURCES = ${testClassLowerCaseName}.cpp";
print MAKEFILEMOD "test${testClassLowerCaseName}_LDADD = $(GLOBALLDADD)";
print MAKEFILEMOD "test${testClassLowerCaseName}_CXXFLAGS = $(GLOBALCXXFLAGS)";

# close the Makefile file handles
close MAKEFILEMOD;
close MAKEFILE;

# save Makefile.am in case we die before done moving things around
system("mv Makefile.am Makefile.am.save");
# move the new Makefile.am to where it belongs
system("mv Makefile.am.mod Makefile.am");
# delete the original Makefile.am
unlink("Makefile.am.save");

}

print << "EOP";

Your test unit has been created now as testClassLowerCaseName.cpp.
print << "EOP";
Your test unit has been created now as ${testClassLowerCaseName}.cpp.
EOP

}else{
}
else
{
# user cancelled
print "Test unit not created\n";
}
@@ -0,0 +1,26 @@
#include <QtTest>
#include <QObject>
#include <QString>
#include <QObject>
//header for class being tested
#include <qgssymbol.h>

class TestQgsSymbol: public QObject
{
Q_OBJECT;
private slots:
void setPointSize()
{
QgsSymbol mySymbol;
mySymbol.setPointSize(4);
int mySize = mySymbol.pointSize();
QCOMPARE(mySize,4);
}
};

QTEST_MAIN(TestQgsSymbol)
#include "testqgssymbol.moc.cpp"




0 comments on commit 6f089dc

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