Skip to content

Commit

Permalink
More clean ups to test builder - warnning it will damge the local mak…
Browse files Browse the repository at this point in the history
…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 committed Apr 8, 2006
1 parent fc66e43 commit 6f089dc
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
10 changes: 8 additions & 2 deletions tests/src/core/Makefile.am
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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)
25 changes: 13 additions & 12 deletions tests/src/core/test_builder.pl
Expand Up @@ -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");
Expand Down Expand Up @@ -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";
}
Expand Down
26 changes: 26 additions & 0 deletions tests/src/core/testqgssymbol.cpp
@@ -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.