Skip to content
Permalink
Browse files
Migrate all uses of of QRegEXp in tests/
  • Loading branch information
nirvn committed Jul 15, 2021
1 parent adb5362 commit 9d64e14209fcb19a58978f187a9b2c8b27aceb21
@@ -52,6 +52,7 @@
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QStandardItemModel>
#include <QRegularExpression>

#include "modeltest.h"
#include "dynamictreemodel.h"
@@ -116,7 +117,7 @@ void tst_ModelTest::stringListModel()
model.setStringList( QStringList() << "a" << "e" << "plop" << "b" << "c" );

proxy.setDynamicSortFilter( true );
proxy.setFilterRegExp( QRegExp( "[^b]" ) );
proxy.setFilterRegularExpression( QRegularExpression( "[^b]" ) );
}

void tst_ModelTest::treeWidgetModel()
@@ -19,6 +19,7 @@
#include <QSplashScreen>
#include <QString>
#include <QStringList>
#include <QRegularExpression>

#include "qgisapp.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
// and helps avoid rounding issues
QRegExp regex( "\\[([-\\d.]+),([-\\d.]+)\\]" );
( void )regex.indexIn( result );
QStringList list = regex.capturedTexts();
QRegularExpression regex( "\\[([-\\d.]+),([-\\d.]+)\\]" );
QRegularExpressionMatch match = regex.match( result );
QStringList list = match.capturedTexts();
QCOMPARE( list.count(), 3 );

int x = std::round( list.at( 1 ).toDouble() );
@@ -23,6 +23,8 @@
#include "qgsapplication.h"
#include "qgsvectorlayer.h"

#include <QRegularExpression>

/**
* \ingroup UnitTests
* This is a unit test for OGC utilities
@@ -103,9 +105,9 @@ void TestQgsOgcUtils::testGeometryFromGML()
static bool compareElements( QDomElement &element1, QDomElement &element2 )
{
QString tag1 = element1.tagName();
tag1.replace( QRegExp( ".*:" ), QString() );
tag1.replace( QRegularExpression( ".*:" ), QString() );
QString tag2 = element2.tagName();
tag2.replace( QRegExp( ".*:" ), QString() );
tag2.replace( QRegularExpression( ".*:" ), QString() );
if ( tag1 != tag2 )
{
qDebug( "Different tag names: %s, %s", tag1.toLatin1().data(), tag2.toLatin1().data() );
@@ -21,6 +21,7 @@
#include <QString>
#include <QStringList>
#include <QTextStream>
#include <QRegularExpression>

#include "qgsapplication.h"
#include "qgsdatasourceuri.h"
@@ -272,8 +273,8 @@ void TestQgsWcsPublicServers::test()
QStringList myServerLog;
myServerLog << "server:" + serverUrl;
QString myServerDirName = serverUrl;
myServerDirName.replace( QRegExp( "[:/]+" ), QStringLiteral( "." ) );
myServerDirName.remove( QRegExp( "\\.$" ) );
myServerDirName.replace( QRegularExpression( "[:/]+" ), QStringLiteral( "." ) );
myServerDirName.remove( QRegularExpression( "\\.$" ) );
QgsDebugMsg( "myServerDirName = " + myServerDirName );

QDir myServerDir( mCacheDir.absolutePath() + '/' + myServerDirName );

0 comments on commit 9d64e14

Please sign in to comment.