mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Improvements to unit builder script - you can pass it the class nema to build the test for from the cli and it will not prompts you and just create everything - to be used in source dir parsing script that Ill add soon...
dded new test unit for qgsgeometry git-svn-id: http://svn.osgeo.org/qgis/trunk@5241 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
971e2d342f
commit
1110aaf576
@ -9,6 +9,7 @@
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
bin_PROGRAMS = testqgsapplication \
|
||||
testqgsgeometry \
|
||||
testqgsfeature \
|
||||
testqgsfield \
|
||||
testqgssymbol
|
||||
@ -28,6 +29,7 @@ GLOBALCXXFLAGS = $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(GDAL_CFLAGS) $(QT_CXXFLAGS) $(P
|
||||
$(MOC) -o $@ $<
|
||||
|
||||
BUILT_SOURCES = $(testqgsapplication_MOC) \
|
||||
$(testqgsgeometry_MOC) \
|
||||
$(testqgsfeature_MOC) \
|
||||
$(testqgsfield_MOC) \
|
||||
$(testqgssymbol_MOC)
|
||||
@ -58,3 +60,8 @@ testqgsfeature_MOC = testqgsfeature.moc.cpp
|
||||
testqgsfeature_SOURCES = testqgsfeature.cpp
|
||||
testqgsfeature_LDADD = $(GLOBALLDADD)
|
||||
testqgsfeature_CXXFLAGS = $(GLOBALCXXFLAGS)
|
||||
|
||||
testqgsgeometry_MOC = testqgsgeometry.moc.cpp
|
||||
testqgsgeometry_SOURCES = testqgsgeometry.cpp
|
||||
testqgsgeometry_LDADD = $(GLOBALLDADD)
|
||||
testqgsgeometry_CXXFLAGS = $(GLOBALCXXFLAGS)
|
||||
|
@ -10,6 +10,7 @@ use Cwd;
|
||||
|
||||
#make sure we are in a the tests/src/core dir
|
||||
$myDir = fastgetcwd;
|
||||
$sourceDir = "../../../src/core";
|
||||
print "\n\nChecking that we are in the <qgis dir>/test/src/core/ directory....";
|
||||
if ($myDir =~ m/tests\/src\/core$/)
|
||||
{
|
||||
@ -23,14 +24,47 @@ else
|
||||
exit;
|
||||
}
|
||||
# get the needed information from the user
|
||||
print "\n\nEnter the name of the class for which the test will be created.\n";
|
||||
print "Used mixed case notation.\n";
|
||||
print "e.g. QgsSymbol\n";
|
||||
$testClass =<STDIN>;
|
||||
chop $testClass;
|
||||
$testClass="";
|
||||
$argCount = $#ARGV+1;
|
||||
if ($argCount > 0)
|
||||
{
|
||||
$testClass=@ARGV[ 0 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\n\nEnter the name of the class for which the test will be created.\n";
|
||||
print "Used mixed case notation.\n";
|
||||
print "e.g. QgsSymbol\n";
|
||||
$testClass =<STDIN>;
|
||||
chop $testClass;
|
||||
}
|
||||
|
||||
$testClassLowerCaseName = lc($testClass); #todo convert to lower case
|
||||
|
||||
#
|
||||
# Check source file is ok
|
||||
#
|
||||
|
||||
if ($testClass eq "")
|
||||
{
|
||||
print "ClassName not supplied ...exiting...";
|
||||
exit;
|
||||
}
|
||||
print "Checking if source class exists in filesystem ...";
|
||||
if (-e "${sourceDir}/${testClassLowerCaseName}.cpp" )
|
||||
{
|
||||
print "yes\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no, exiting\n";
|
||||
print "${sourceDir}/${testClassLowerCaseName}.cpp does not exist!\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
print "Stubs will be created for the following methods:\n";
|
||||
open CPPFILE, "<../../../src/core/$testClassLowerCaseName.cpp"|| die 'Unable to open header file $testClassLowerCaseName.cpp';
|
||||
open CPPFILE, "<$sourceDir/$testClassLowerCaseName.cpp"|| die 'Unable to open header file $testClassLowerCaseName.cpp';
|
||||
$stubString="";
|
||||
$lastLine="";
|
||||
while(<CPPFILE>)
|
||||
@ -58,10 +92,18 @@ while(<CPPFILE>)
|
||||
$lastLine=$line;
|
||||
}
|
||||
}
|
||||
print "-----------------------------\n";
|
||||
print "Create the unit test? [y/n]: ";
|
||||
$createIt = <STDIN>;
|
||||
chop $createIt;
|
||||
$createIt="n";
|
||||
if ($argCount eq 0)
|
||||
{
|
||||
print "-----------------------------\n";
|
||||
print "Create the unit test? [y/n]: ";
|
||||
$createIt = <STDIN>;
|
||||
chop $createIt;
|
||||
}
|
||||
else
|
||||
{
|
||||
$createIt="y";
|
||||
}
|
||||
|
||||
if(($createIt eq 'y') || ($createIt eq 'Y'))
|
||||
{
|
||||
|
100
tests/src/core/testqgsgeometry.cpp
Normal file
100
tests/src/core/testqgsgeometry.cpp
Normal file
@ -0,0 +1,100 @@
|
||||
#include <QtTest>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
//header for class being tested
|
||||
#include <qgsgeometry.h>
|
||||
|
||||
class TestQgsGeometry: public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
private slots:
|
||||
void QgsGeometryQgsGeometry()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrysetWkbAndOwnership()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrywkbBuffer()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrywkbSize()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrywkt()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrysetGeos()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryclosestVertex()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryinsertVertexBefore()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrymoveVertexAt()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrydeleteVertexAt()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryvertexAt()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryclosestVertexWithContext()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryclosestSegmentWithContext()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryboundingBox()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryintersects()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryexportToWkt()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrygeosGeometry()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryexportWkbToGeos()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometryexportGeosToWkb()
|
||||
{
|
||||
|
||||
};
|
||||
void QgsGeometrydistanceSquaredPointToSegment()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
QTEST_MAIN(TestQgsGeometry)
|
||||
#include "testqgsgeometry.moc.cpp"
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user