mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Migrate all uses of of QRegEXp in tests/
This commit is contained in:
parent
adb5362463
commit
9d64e14209
@ -52,6 +52,7 @@
|
|||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include "modeltest.h"
|
#include "modeltest.h"
|
||||||
#include "dynamictreemodel.h"
|
#include "dynamictreemodel.h"
|
||||||
@ -116,7 +117,7 @@ void tst_ModelTest::stringListModel()
|
|||||||
model.setStringList( QStringList() << "a" << "e" << "plop" << "b" << "c" );
|
model.setStringList( QStringList() << "a" << "e" << "plop" << "b" << "c" );
|
||||||
|
|
||||||
proxy.setDynamicSortFilter( true );
|
proxy.setDynamicSortFilter( true );
|
||||||
proxy.setFilterRegExp( QRegExp( "[^b]" ) );
|
proxy.setFilterRegularExpression( QRegularExpression( "[^b]" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_ModelTest::treeWidgetModel()
|
void tst_ModelTest::treeWidgetModel()
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <QSplashScreen>
|
#include <QSplashScreen>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include "qgisapp.h"
|
#include "qgisapp.h"
|
||||||
#include "qgsapplication.h"
|
#include "qgsapplication.h"
|
||||||
@ -179,9 +180,9 @@ void TestQgisAppClipboard::copyToText()
|
|||||||
|
|
||||||
// just test coordinates as integers - that's enough to verify that reprojection has occurred
|
// just test coordinates as integers - that's enough to verify that reprojection has occurred
|
||||||
// and helps avoid rounding issues
|
// and helps avoid rounding issues
|
||||||
QRegExp regex( "\\[([-\\d.]+),([-\\d.]+)\\]" );
|
QRegularExpression regex( "\\[([-\\d.]+),([-\\d.]+)\\]" );
|
||||||
( void )regex.indexIn( result );
|
QRegularExpressionMatch match = regex.match( result );
|
||||||
QStringList list = regex.capturedTexts();
|
QStringList list = match.capturedTexts();
|
||||||
QCOMPARE( list.count(), 3 );
|
QCOMPARE( list.count(), 3 );
|
||||||
|
|
||||||
int x = std::round( list.at( 1 ).toDouble() );
|
int x = std::round( list.at( 1 ).toDouble() );
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#include "qgsapplication.h"
|
#include "qgsapplication.h"
|
||||||
#include "qgsvectorlayer.h"
|
#include "qgsvectorlayer.h"
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup UnitTests
|
* \ingroup UnitTests
|
||||||
* This is a unit test for OGC utilities
|
* This is a unit test for OGC utilities
|
||||||
@ -103,9 +105,9 @@ void TestQgsOgcUtils::testGeometryFromGML()
|
|||||||
static bool compareElements( QDomElement &element1, QDomElement &element2 )
|
static bool compareElements( QDomElement &element1, QDomElement &element2 )
|
||||||
{
|
{
|
||||||
QString tag1 = element1.tagName();
|
QString tag1 = element1.tagName();
|
||||||
tag1.replace( QRegExp( ".*:" ), QString() );
|
tag1.replace( QRegularExpression( ".*:" ), QString() );
|
||||||
QString tag2 = element2.tagName();
|
QString tag2 = element2.tagName();
|
||||||
tag2.replace( QRegExp( ".*:" ), QString() );
|
tag2.replace( QRegularExpression( ".*:" ), QString() );
|
||||||
if ( tag1 != tag2 )
|
if ( tag1 != tag2 )
|
||||||
{
|
{
|
||||||
qDebug( "Different tag names: %s, %s", tag1.toLatin1().data(), tag2.toLatin1().data() );
|
qDebug( "Different tag names: %s, %s", tag1.toLatin1().data(), tag2.toLatin1().data() );
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include "qgsapplication.h"
|
#include "qgsapplication.h"
|
||||||
#include "qgsdatasourceuri.h"
|
#include "qgsdatasourceuri.h"
|
||||||
@ -272,8 +273,8 @@ void TestQgsWcsPublicServers::test()
|
|||||||
QStringList myServerLog;
|
QStringList myServerLog;
|
||||||
myServerLog << "server:" + serverUrl;
|
myServerLog << "server:" + serverUrl;
|
||||||
QString myServerDirName = serverUrl;
|
QString myServerDirName = serverUrl;
|
||||||
myServerDirName.replace( QRegExp( "[:/]+" ), QStringLiteral( "." ) );
|
myServerDirName.replace( QRegularExpression( "[:/]+" ), QStringLiteral( "." ) );
|
||||||
myServerDirName.remove( QRegExp( "\\.$" ) );
|
myServerDirName.remove( QRegularExpression( "\\.$" ) );
|
||||||
QgsDebugMsg( "myServerDirName = " + myServerDirName );
|
QgsDebugMsg( "myServerDirName = " + myServerDirName );
|
||||||
|
|
||||||
QDir myServerDir( mCacheDir.absolutePath() + '/' + myServerDirName );
|
QDir myServerDir( mCacheDir.absolutePath() + '/' + myServerDirName );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user