From 00c09aaf5bac2ae2ee46b20bfbb4b46379ba90e7 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Fri, 13 Mar 2015 11:04:36 -0300 Subject: Fix build of tests on QNX. Change-Id: Ib28e42e3eb10e26555fe392c55534f715bee5f8b Reviewed-by: Simon Hausmann --- .../qtconcurrentrun/tst_qtconcurrentrun.cpp | 4 +- .../tools/qeasingcurve/tst_qeasingcurve.cpp | 4 +- tests/auto/corelib/tools/qpointf/tst_qpointf.cpp | 4 +- tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp | 96 +++++++++++----------- tests/benchmarks/corelib/tools/qregexp/main.cpp | 54 +++++++++--- tests/benchmarks/corelib/tools/qregexp/qregexp.pro | 8 +- 6 files changed, 101 insertions(+), 69 deletions(-) diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp index 3d0b102b1c..8ffe4d8dfe 100644 --- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -385,14 +385,14 @@ void tst_QtConcurrentRun::recursive() count.store(0); QThreadPool::globalInstance()->setMaxThreadCount(i); recursiveRun(levels); - QCOMPARE(count.load(), (int)pow(2.0, levels) - 1); + QCOMPARE(count.load(), (int)std::pow(2.0, levels) - 1); } for (int i = 0; i < QThread::idealThreadCount(); ++i) { count.store(0); QThreadPool::globalInstance()->setMaxThreadCount(i); recursiveResult(levels); - QCOMPARE(count.load(), (int)pow(2.0, levels) - 1); + QCOMPARE(count.load(), (int)std::pow(2.0, levels) - 1); } } diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp index b33982695b..8726f77e58 100644 --- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp @@ -753,7 +753,7 @@ void tst_QEasingCurve::testCbrtDouble() if (f != 0.0) t = t * (t_cubic + d + d) / f; - double expected = pow(d, 1.0/3.0); + double expected = std::pow(d, 1.0/3.0); const qreal error = qAbs(expected - t); @@ -779,7 +779,7 @@ void tst_QEasingCurve::testCbrtFloat() if (fac != 0.0f) t = t * (t_cubic + f + f) / fac; - float expected = pow(f, float(1.0/3.0)); + float expected = std::pow(f, float(1.0/3.0)); const qreal error = qAbs(expected - t); diff --git a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp index 436cedcca7..ff58c9b181 100644 --- a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp +++ b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp @@ -275,12 +275,12 @@ void tst_QPointF::division() { { QPointF p(1e-14, 1e-14); - p = p / sqrt(dot(p, p)); + p = p / std::sqrt(dot(p, p)); QCOMPARE(dot(p, p), qreal(1.0)); } { QPointF p(1e-14, 1e-14); - p /= sqrt(dot(p, p)); + p /= std::sqrt(dot(p, p)); QCOMPARE(dot(p, p), qreal(1.0)); } } diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp index a1017eea3b..c4c4789b7a 100644 --- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp +++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp @@ -152,125 +152,125 @@ void tst_QWMatrix::mapping_data() // rotations float deg = 0.; - QTest::newRow( "rot 0 a" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 0 a" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon ( QRect( 0, 0, 30, 40 ) ); deg = 0.00001f; - QTest::newRow( "rot 0 b" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 0 b" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon ( QRect( 0, 0, 30, 40 ) ); deg = 0.; - QTest::newRow( "rot 0 c" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 0 c" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon ( QRect( 10, 20, 30, 40 ) ); deg = 0.00001f; - QTest::newRow( "rot 0 d" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 0 d" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon ( QRect( 10, 20, 30, 40 ) ); #if 0 // rotations deg = 90.; - QTest::newRow( "rotscale 90 a" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 90 a" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( 0, -299, 400, 300 ) ); deg = 90.00001; - QTest::newRow( "rotscale 90 b" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 90 b" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( 0, -299, 400, 300 ) ); deg = 90.; - QTest::newRow( "rotscale 90 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 90 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( 200, -399, 400, 300 ) ); deg = 90.00001; - QTest::newRow( "rotscale 90 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 90 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( 200, -399, 400, 300 ) ); deg = 180.; - QTest::newRow( "rotscale 180 a" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 180 a" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( -299, -399, 300, 400 ) ); deg = 180.000001; - QTest::newRow( "rotscale 180 b" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 180 b" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( -299, -399, 300, 400 ) ); deg = 180.; - QTest::newRow( "rotscale 180 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 180 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( -399, -599, 300, 400 ) ); deg = 180.000001; - QTest::newRow( "rotscale 180 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 180 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( -399, -599, 300, 400 ) ); deg = 270.; - QTest::newRow( "rotscale 270 a" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 270 a" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( -399, 00, 400, 300 ) ); deg = 270.0000001; - QTest::newRow( "rotscale 270 b" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 270 b" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( -399, 00, 400, 300 ) ); deg = 270.; - QTest::newRow( "rotscale 270 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 270 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( -599, 100, 400, 300 ) ); deg = 270.000001; - QTest::newRow( "rotscale 270 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rotscale 270 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( -599, 100, 400, 300 ) ); // rotations that are not multiples of 90 degrees. mapRect returns the bounding rect here. deg = 45; - QTest::newRow( "rot 45 a" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 45 a" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 10, 10 ) << QPolygon( QRect( 0, -7, 14, 14 ) ); - QTest::newRow( "rot 45 b" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 45 b" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( 21, -14, 49, 49 ) ); - QTest::newRow( "rot 45 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 45 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 10, 10 ) << QPolygon( QRect( 0, -70, 141, 141 ) ); - QTest::newRow( "rot 45 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot 45 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( 212, -141, 495, 495 ) ); deg = -45; - QTest::newRow( "rot -45 a" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot -45 a" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 10, 10 ) << QPolygon( QRect( -7, 0, 14, 14 ) ); - QTest::newRow( "rot -45 b" ) << QMatrix( cos( M_PI*deg/180. ), -sin( M_PI*deg/180. ), - sin( M_PI*deg/180. ), cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot -45 b" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ), + std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( -35, 21, 49, 49 ) ); - QTest::newRow( "rot -45 c" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot -45 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 0, 0, 10, 10 ) << QPolygon( QRect( -70, 0, 141, 141 ) ); - QTest::newRow( "rot -45 d" ) << QMatrix( 10*cos( M_PI*deg/180. ), -10*sin( M_PI*deg/180. ), - 10*sin( M_PI*deg/180. ), 10*cos( M_PI*deg/180. ), 0, 0 ) + QTest::newRow( "rot -45 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ), + 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 ) << QRect( 10, 20, 30, 40 ) << QPolygon( QRect( -353, 212, 495, 495 ) ); #endif diff --git a/tests/benchmarks/corelib/tools/qregexp/main.cpp b/tests/benchmarks/corelib/tools/qregexp/main.cpp index 88d3b3fa96..aa31b037fe 100644 --- a/tests/benchmarks/corelib/tools/qregexp/main.cpp +++ b/tests/benchmarks/corelib/tools/qregexp/main.cpp @@ -75,17 +75,13 @@ private slots: void rangeReplace2(); void matchReplace2(); -#ifdef HAVE_JSC void simpleFindJSC(); void rangeReplaceJSC(); void matchReplaceJSC(); -#endif -#ifdef HAVE_BOOST void simpleFindBoost(); void rangeReplaceBoost(); void matchReplaceBoost(); -#endif /* those apply an (incorrect) regexp on entire source (this main.cpp). JSC appears to handle this @@ -95,14 +91,10 @@ private slots: void horribleReplace1(); void horribleReplace2(); void horribleWrongReplace2(); -#ifdef HAVE_JSC void horribleWrongReplaceJSC(); void horribleReplaceJSC(); -#endif -#ifdef HAVE_BOOST void horribleWrongReplaceBoost(); void horribleReplaceBoost(); -#endif private: QString str1; QString str2; @@ -451,9 +443,9 @@ void tst_qregexp::horribleReplace2() } QCOMPARE(r, QString("1.2.3")); } -#ifdef HAVE_JSC void tst_qregexp::simpleFindJSC() { +#ifdef HAVE_JSC int numr; const char * errmsg=" "; QString rxs("happy"); @@ -467,10 +459,14 @@ void tst_qregexp::simpleFindJSC() jsRegExpFree(rx); QCOMPARE(numr, 1); QCOMPARE(offsetVector[0], 11); +#else + QSKIP("JSC is not enabled for this platform"); +#endif } void tst_qregexp::rangeReplaceJSC() { +#ifdef HAVE_JSC QScriptValue r; QScriptEngine engine; engine.globalObject().setProperty("s", str1); @@ -480,10 +476,14 @@ void tst_qregexp::rangeReplaceJSC() r = replaceFunc.call(QScriptValue()); } QCOMPARE(r.toString(), QString("W- -r- -ll h-ppy monk-ys")); +#else + QSKIP("JSC is not enabled for this platform"); +#endif } void tst_qregexp::matchReplaceJSC() { +#ifdef HAVE_JSC QScriptValue r; QScriptEngine engine; engine.globalObject().setProperty("s", str1); @@ -493,10 +493,14 @@ void tst_qregexp::matchReplaceJSC() r = replaceFunc.call(QScriptValue()); } QCOMPARE(r.toString(), QString("eaeaae")); +#else + QSKIP("JSC is not enabled for this platform"); +#endif } void tst_qregexp::horribleWrongReplaceJSC() { +#ifdef HAVE_JSC QScriptValue r; QScriptEngine engine; engine.globalObject().setProperty("s", str2); @@ -506,10 +510,14 @@ void tst_qregexp::horribleWrongReplaceJSC() r = replaceFunc.call(QScriptValue()); } QCOMPARE(r.toString(), str2); +#else + QSKIP("JSC is not enabled for this platform"); +#endif } void tst_qregexp::horribleReplaceJSC() { +#ifdef HAVE_JSC QScriptValue r; QScriptEngine engine; // the m flag doesn't actually work here; dunno @@ -520,11 +528,14 @@ void tst_qregexp::horribleReplaceJSC() r = replaceFunc.call(QScriptValue()); } QCOMPARE(r.toString(), QString("1.2.3")); -} +#else + QSKIP("JSC is not enabled for this platform"); #endif +} +void tst_qregexp::simpleFindBoost() +{ #ifdef HAVE_BOOST -void tst_qregexp::simpleFindBoost(){ int roff; boost::regex rx ("happy", boost::regex_constants::perl); std::string s = str1.toStdString(); @@ -538,10 +549,15 @@ void tst_qregexp::simpleFindBoost(){ roff = (what[0].first)-start; } QCOMPARE(roff, 11); +#else + QSKIP("Boost is not enabled for this platform"); +#endif + } void tst_qregexp::rangeReplaceBoost() { +#ifdef HAVE_BOOST boost::regex pattern ("[a-f]", boost::regex_constants::perl); std::string s = str1.toStdString(); std::string r; @@ -549,10 +565,14 @@ void tst_qregexp::rangeReplaceBoost() r = boost::regex_replace (s, pattern, "-"); } QCOMPARE(r, std::string("W- -r- -ll h-ppy monk-ys")); +#else + QSKIP("Boost is not enabled for this platform"); +#endif } void tst_qregexp::matchReplaceBoost() { +#ifdef HAVE_BOOST boost::regex pattern ("[^a-f]*([a-f]+)[^a-f]*",boost::regex_constants::perl); std::string s = str1.toStdString(); std::string r; @@ -560,10 +580,14 @@ void tst_qregexp::matchReplaceBoost() r = boost::regex_replace (s, pattern, "$1"); } QCOMPARE(r, std::string("eaeaae")); +#else + QSKIP("Boost is not enabled for this platform"); +#endif } void tst_qregexp::horribleWrongReplaceBoost() { +#ifdef HAVE_BOOST boost::regex pattern (".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*", boost::regex_constants::perl); std::string s = str2.toStdString(); std::string r; @@ -571,10 +595,14 @@ void tst_qregexp::horribleWrongReplaceBoost() r = boost::regex_replace (s, pattern, "$1.$2.$3"); } QCOMPARE(r, s); +#else + QSKIP("Boost is not enabled for this platform"); +#endif } void tst_qregexp::horribleReplaceBoost() { +#ifdef HAVE_BOOST boost::regex pattern (".*#""define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*", boost::regex_constants::perl); std::string s = str2.toStdString(); std::string r; @@ -582,8 +610,10 @@ void tst_qregexp::horribleReplaceBoost() r = boost::regex_replace (s, pattern, "$1.$2.$3"); } QCOMPARE(r, std::string("1.2.3")); +#else + QSKIP("Boost is not enabled for this platform"); +#endif } -#endif //HAVE_BOOST QTEST_MAIN(tst_qregexp) diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro index d194d2b698..8b35ecffed 100644 --- a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro +++ b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro @@ -11,9 +11,11 @@ qtHaveModule(script):!pcre { QT += script } -exists($$[QT_SYSROOT]/usr/include/boost/regex.hpp) { -DEFINES+=HAVE_BOOST -LIBS+=-lboost_regex +!qnx { + exists($$[QT_SYSROOT]/usr/include/boost/regex.hpp) { + DEFINES += HAVE_BOOST + LIBS += -lboost_regex + } } DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3