void testGetQuotaRoot() { QFETCH( QString, mailbox ); QFETCH( QList<QByteArray>, roots ); QFETCH( QList<QByteArray>, resources ); QFETCH( QList<qint64>, usages ); QFETCH( QList<qint64>, limits ); QFETCH( QList<QByteArray>, scenario ); FakeServer fakeServer; fakeServer.setScenario( scenario ); fakeServer.startAndWait(); KIMAP::Session session( "127.0.0.1", 5989 ); KIMAP::GetQuotaRootJob *job = new KIMAP::GetQuotaRootJob( &session ); job->setMailBox( mailbox ); bool result = job->exec(); QEXPECT_FAIL( "bad" , "Expected failure on BAD response", Continue ); QEXPECT_FAIL( "no" , "Expected failure on NO response", Continue ); QVERIFY( result ); QEXPECT_FAIL( "rootname missmatch" , "Expected failure on rootname missmatch in QUOTAROOT and QUOTA response", Abort ); QCOMPARE( job->roots(), roots ); for ( int rootIdx = 0; rootIdx < roots.size(); rootIdx++ ) { const QByteArray &root = roots[rootIdx]; for ( int i = 0; i < resources.size(); i++ ) { int idx = i + rootIdx * roots.size(); QByteArray resource = resources[i]; QCOMPARE( job->limit( root, resource ), limits[idx] ); QCOMPARE( job->usage( root, resource ), usages[idx] ); } } fakeServer.quit(); }
void tst_QPauseAnimationJob::noTimerUpdates() { EnableConsistentTiming enabled; QFETCH(int, duration); QFETCH(int, loopCount); TestablePauseAnimation animation; animation.setDuration(duration); animation.setLoopCount(loopCount); animation.start(); QTest::qWait(animation.totalDuration() + 100); #ifdef Q_OS_WIN if (animation.state() != QAbstractAnimationJob::Stopped) QEXPECT_FAIL("", winTimerError, Abort); #endif QVERIFY(animation.state() == QAbstractAnimationJob::Stopped); const int expectedLoopCount = 1 + loopCount; #ifdef Q_OS_WIN if (animation.m_updateCurrentTimeCount != expectedLoopCount) QEXPECT_FAIL("", winTimerError, Abort); #endif QCOMPARE(animation.m_updateCurrentTimeCount, expectedLoopCount); }
void tst_QNumeric::qNan() { #if defined __FAST_MATH__ && (__GNUC__ * 100 + __GNUC_MINOR__ < 404) QSKIP("Non-conformant fast math mode is enabled, cannot run test"); #endif double nan = qQNaN(); QVERIFY(!(0 > nan)); QVERIFY(!(0 < nan)); QVERIFY(qIsNaN(nan)); QVERIFY(qIsNaN(nan + 1)); QVERIFY(qIsNaN(-nan)); double inf = qInf(); QVERIFY(inf > 0); QVERIFY(-inf < 0); QVERIFY(qIsInf(inf)); QVERIFY(qIsInf(-inf)); QVERIFY(qIsInf(2*inf)); QCOMPARE(1/inf, 0.0); #ifdef Q_CC_INTEL QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue); #endif QVERIFY(qIsNaN(0*nan)); #ifdef Q_CC_INTEL QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue); #endif QVERIFY(qIsNaN(0*inf)); QVERIFY(qFuzzyCompare(1/inf, 0.0)); }
void SchroniskoTesty::testAtrybutyPsa() { Pies pies(24345, "Azor", 4, Lagodny, "Pudel" ); QCOMPARE( 24345, pies.getId() ); QCOMPARE( QString("Azor"), pies.getImie() ); QCOMPARE( 4, pies.getWiek() ); QCOMPARE( Lagodny, pies.getRodzaj() ); QCOMPARE( QString("Pudel"), pies.getRasa() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodny numer ID", Continue); QCOMPARE( 98345, pies.getId() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodne imie", Continue); QCOMPARE( QString("Burek"), pies.getImie() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodny wiek", Continue); QCOMPARE( 12, pies.getWiek() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodny rodzaj", Continue); QCOMPARE( Grozny, pies.getRodzaj() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodna rasa", Continue); QCOMPARE( QString("Owczarek Bernaski"), pies.getRasa() ); }
void SchroniskoTesty::testAtrybutyKlienta() { Klient klient(123, "Adam", "Kowalski", "ul. Kościelna 12; Bydgoszcz; 85790", 600821340); QCOMPARE( 123, klient.getId() ); QCOMPARE( QString("Adam"), klient.getImie() ); QCOMPARE( QString("Kowalski"), klient.getNazwisko() ); QCOMPARE( QString("ul. Kościelna 12; Bydgoszcz; 85790"), klient.getUlica() ); QCOMPARE( 600821340, klient.getNumerTelefonu() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodny numer Id", Continue); QCOMPARE( 345, klient.getId()); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodne imie", Continue); QCOMPARE( QString("Kuba"), klient.getImie()); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodne nazwisko", Continue); QCOMPARE( QString("Nowicki"), klient.getNazwisko() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodna ulica", Continue); QCOMPARE( QString("ul. Sławków 3; Lublin; 44230"), klient.getUlica() ); QEXPECT_FAIL("", "test na niewłaściwe dane : niezgodny numer", Continue); QCOMPARE( 515987464, klient.getNumerTelefonu() ); }
void tst_StrCmp::compareByteArray() const { QByteArray ba = "foo"; QEXPECT_FAIL("", "Next test should fail", Continue); QCOMPARE(ba.constData(), "bar"); QCOMPARE(ba.constData(), "foo"); char *bar = "bar"; char *foo = "foo"; QEXPECT_FAIL("", "Next test should fail", Continue); QCOMPARE(ba.data(), bar); QCOMPARE(ba.data(), foo); const char *cbar = "bar"; const char *cfoo = "foo"; QEXPECT_FAIL("", "Next test should fail", Continue); QCOMPARE(ba.constData(), cbar); QCOMPARE(ba.constData(), cfoo); /* Create QByteArrays of the size that makes the corresponding toString() crop output. */ const QByteArray b(500, 'A'); const QByteArray a(500, 'B'); QCOMPARE(a, b); }
void commandData() { QFETCH(bool, pass); QEXPECT_FAIL("row2", "expectedFailureData1", Abort); QVERIFY2(pass, "fail"); QEXPECT_FAIL("row3", "expectedFailureData2", Continue); QVERIFY(pass); }
void tst_ExpectFail::xfailTwice() const { QEXPECT_FAIL("", "Calling QEXPECT_FAIL once is fine", Abort); QEXPECT_FAIL("", "Calling QEXPECT_FAIL when already expecting a failure is " "an error and should abort this test function", Abort); // If we get here the test did not correctly abort on the double call to QEXPECT_FAIL. QVERIFY2(false, "This should not be reached"); }
void tst_ExpectFail::xfailWithQString() const { QEXPECT_FAIL("", QString("A string").toLatin1().constData(), Continue); QVERIFY(false); int bugNo = 5; QString msg("The message"); QEXPECT_FAIL( "", QString("Bug %1 (%2)").arg(bugNo).arg(msg).toLatin1().constData(), Continue); QVERIFY(false); }
void PythonQtTestSlotCalling::testInheritance() { PythonQt::self()->registerCPPClass("ClassA",NULL,NULL, PythonQtCreateObject<ClassAWrapper>); PythonQt::self()->registerCPPClass("ClassB",NULL,NULL, PythonQtCreateObject<ClassBWrapper>); PythonQt::self()->registerCPPClass("ClassC",NULL,NULL, PythonQtCreateObject<ClassCWrapper>); PythonQt::self()->addParentClass("ClassC", "ClassA", PythonQtUpcastingOffset<ClassC,ClassA>()); PythonQt::self()->addParentClass("ClassC", "ClassB", PythonQtUpcastingOffset<ClassC,ClassB>()); PythonQt::self()->registerClass(&ClassD::staticMetaObject, NULL, PythonQtCreateObject<ClassDWrapper>); PythonQt::self()->addParentClass("ClassD", "ClassA", PythonQtUpcastingOffset<ClassD,ClassA>()); PythonQt::self()->addParentClass("ClassD", "ClassB", PythonQtUpcastingOffset<ClassD,ClassB>()); PythonQtObjectPtr classA = PythonQt::self()->getMainModule().getVariable("PythonQt.private.ClassA"); PythonQtObjectPtr classB = PythonQt::self()->getMainModule().getVariable("PythonQt.private.ClassB"); PythonQtObjectPtr classC = PythonQt::self()->getMainModule().getVariable("PythonQt.private.ClassC"); PythonQtObjectPtr classD = PythonQt::self()->getMainModule().getVariable("PythonQt.private.ClassD"); QVERIFY(classA); QVERIFY(classB); QVERIFY(classC); QVERIFY(classD); QVERIFY(_helper->runScript("a = PythonQt.private.ClassA();\nif obj.getClassAPtr(a).getX()==1: obj.setPassed();\n")); QEXPECT_FAIL("", "ClassB can not be converted to ClassA", Continue); QVERIFY(_helper->runScript("a = PythonQt.private.ClassB();\nif obj.getClassAPtr(a).getX()==1: obj.setPassed();\n")); QVERIFY(_helper->runScript("a = PythonQt.private.ClassC();\nif obj.getClassAPtr(a).getX()==1: obj.setPassed();\n")); QVERIFY(_helper->runScript("a = PythonQt.private.ClassD();\nif obj.getClassAPtr(a).getX()==1: obj.setPassed();\n")); QEXPECT_FAIL("", "ClassA can not be converted to ClassB", Continue); QVERIFY(_helper->runScript("a = PythonQt.private.ClassA();\nif obj.getClassBPtr(a).getY()==2: obj.setPassed();\n")); QVERIFY(_helper->runScript("a = PythonQt.private.ClassB();\nif obj.getClassBPtr(a).getY()==2: obj.setPassed();\n")); QVERIFY(_helper->runScript("a = PythonQt.private.ClassC();\nif obj.getClassBPtr(a).getY()==2: obj.setPassed();\n")); QVERIFY(_helper->runScript("a = PythonQt.private.ClassD();\nif obj.getClassBPtr(a).getY()==2: obj.setPassed();\n")); QEXPECT_FAIL("", "ClassA can not be converted to ClassC", Continue); QVERIFY(_helper->runScript("a = PythonQt.private.ClassA();\nif obj.getClassCPtr(a).getX()==1: obj.setPassed();\n")); QEXPECT_FAIL("", "ClassB can not be converted to ClassC", Continue); QVERIFY(_helper->runScript("a = PythonQt.private.ClassB();\nif obj.getClassCPtr(a).getX()==1: obj.setPassed();\n")); QVERIFY(_helper->runScript("a = PythonQt.private.ClassC();\nif obj.getClassCPtr(a).getX()==1: obj.setPassed();\n")); QEXPECT_FAIL("", "ClassD can not be converted to ClassC", Continue); QVERIFY(_helper->runScript("a = PythonQt.private.ClassD();\nif obj.getClassCPtr(a).getX()==1: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassA())==PythonQt.private.ClassA: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassB())==PythonQt.private.ClassB: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassCAsA())==PythonQt.private.ClassA: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassCAsB())==PythonQt.private.ClassB: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassD())==PythonQt.private.ClassD: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassDAsA())==PythonQt.private.ClassA: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassDAsB())==PythonQt.private.ClassB: obj.setPassed();\n")); PythonQt::self()->addPolymorphicHandler("ClassB", polymorphic_ClassB_Handler); QVERIFY(_helper->runScript("if type(obj.getClassBPtr(obj.createClassB()))==PythonQt.private.ClassB: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassCAsB())==PythonQt.private.ClassC: obj.setPassed();\n")); QVERIFY(_helper->runScript("if type(obj.createClassDAsB())==PythonQt.private.ClassD: obj.setPassed();\n")); }
void Foo::test_case1() { qDebug() << "test_case1"; QFETCH(int, val); QEXPECT_FAIL("test2", "2", Continue); QCOMPARE(val, 1); QEXPECT_FAIL("test1", "bla", Abort); QCOMPARE(val, 2); QVERIFY2(true, "Hallo"); }
void tst_ExpectFail::expectAndAbort() const { qDebug("begin"); QEXPECT_FAIL("", "This should xfail", Abort); QVERIFY(false); qDebug("this should not be reached"); }
void tst_ExpectFail::expectAndContinue() const { qDebug("begin"); QEXPECT_FAIL("", "This should xfail", Continue); QVERIFY(false); qDebug("after"); }
void tst_QStaticText::scaledPainter() { QPixmap imageDrawText(1000, 1000); imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.scale(2.0, 0.2); p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } QPixmap imageDrawStaticText(1000, 1000); imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.scale(2.0, 0.2); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.setTextFormat(Qt::PlainText); p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); }
void tst_QDesktopWidget::screenNumberForQPoint() { // make sure QDesktopWidget::screenNumber(QPoint) returns the correct screen QDesktopWidget *desktopWidget = QApplication::desktop(); QRect allScreens; for (int i = 0; i < desktopWidget->numScreens(); ++i) { QRect screenGeometry = desktopWidget->screenGeometry(i); QCOMPARE(desktopWidget->screenNumber(screenGeometry.center()), i); allScreens |= screenGeometry; } // make sure QDesktopWidget::screenNumber(QPoint) returns a valid screen for points that aren't on any screen int screen; screen = desktopWidget->screenNumber(allScreens.topLeft() - QPoint(1, 1)); #ifdef Q_WS_QWS QEXPECT_FAIL("", "Task 151710", Abort); #endif QVERIFY(screen >= 0 && screen < desktopWidget->numScreens()); screen = desktopWidget->screenNumber(allScreens.topRight() + QPoint(1, 1)); QVERIFY(screen >= 0 && screen < desktopWidget->numScreens()); screen = desktopWidget->screenNumber(allScreens.bottomLeft() - QPoint(1, 1)); QVERIFY(screen >= 0 && screen < desktopWidget->numScreens()); screen = desktopWidget->screenNumber(allScreens.bottomRight() + QPoint(1, 1)); QVERIFY(screen >= 0 && screen < desktopWidget->numScreens()); }
void TestExtWeather::run() { // init spy QSignalSpy spy(extWeather, SIGNAL(dataReceived(const QVariantHash &))); QVariantHash firstValue = extWeather->run(); // check values QVERIFY(spy.wait(5000)); QVariantHash arguments = spy.takeFirst().at(0).toHash(); QEXPECT_FAIL("", "WeatherID should not be 0", Continue); QCOMPARE(arguments[extWeather->tag("weatherId")].toInt(), 0); QVERIFY( (arguments[extWeather->tag("humidity")].toInt() >= humidity.first) && (arguments[extWeather->tag("humidity")].toInt() <= humidity.second)); QVERIFY( (arguments[extWeather->tag("pressure")].toInt() > pressure.first) && (arguments[extWeather->tag("pressure")].toInt() < pressure.second)); QVERIFY( (arguments[extWeather->tag("temperature")].toFloat() > temp.first) && (arguments[extWeather->tag("temperature")].toFloat() < temp.second)); // image should be only one symbol here if (extWeather->jsonMapFile().isEmpty()) QSKIP("No json map found for weather, skip image test"); QCOMPARE(arguments[extWeather->tag("weather")].toString().count(), 1); }
void tst_QTextScriptEngine::gurmukhi() { #if defined(Q_WS_X11) { if (QFontDatabase().families(QFontDatabase::Gurmukhi).contains("Lohit Punjabi")) { QFont f("Lohit Punjabi"); const ShapeTable shape_table [] = { { { 0xA15, 0xA4D, 0xa39, 0x0 }, { 0x3b, 0x8b, 0x0 } }, { {0}, {0} } }; const ShapeTable *s = shape_table; while (s->unicode[0]) { QEXPECT_FAIL("", "QTBUG-26495", Abort); QVERIFY( shaping(f, s) ); ++s; } } else { QSKIP("couln't find Lohit Punjabi", SkipAll); } } #endif }
void tst_QTextScriptEngine::thaiMultipleVowels() { QString s(QString::fromUtf8("ส")); for (int i = 0; i < 100; i++) s += QChar(0x0E47); // Add lots of "VOWEL SIGN MAI TAI KHU N/S-T" stacked on top of the character s += QChar(0x200D); // Now add a zero width joiner (which adds a circle which is hidden) for (int i = 0; i < 100; i++) s += QChar(0x0E47); //Add lots of "VOWEL SIGN MAI TAI KHU N/S-T" stacked on top of the ZWJ for (int i = 0; i < 10; i++) s += s; //Repeat the string to make it more likely to crash if we have a buffer overflow QTextLayout layout(s); layout.beginLayout(); layout.createLine(); layout.endLayout(); QTextEngine *e = layout.engine(); e->width(0, s.length()); //force itemize and shape int k = 0; for (int i = 0; i < e->layoutData->items.size(); i++) for (int j = 0; j < e->layoutData->items[i].num_glyphs; j++) { bool isZWJ = k%401 == 200; #if defined(Q_OS_MAC) || defined(Q_OS_WIN) if ((bool)e->layoutData->glyphLayout.attributes[k].dontPrint != isZWJ) { QEXPECT_FAIL("", "QTBUG-26495", Abort); } #endif QCOMPARE((bool)e->layoutData->glyphLayout.attributes[k++].dontPrint, isZWJ); } }
void SqliteTests::datetime() { User user1; user1.userId = "tester"; user1.name = "tester"; user1.passwd = "12345678"; QDateTime datetime = QDateTime::currentDateTime().toUTC(); user1.lastLoginTime = datetime; QVERIFY(user1.clean()); QVERIFY(user1.save()); User user2; QVERIFY(user2.load(DQWhere("userId=","tester"))); #if (QT_VERSION > QT_VERSION_CHECK(5, 0, 2)) // The timezone checking do not exists in Qt 5.0.2 QEXPECT_FAIL("","Sqlite driver do not save the time zone of QDateTime type",Continue); #endif QVERIFY(user2.lastLoginTime == datetime); QString format("yyyy-MM-ddThh:mm:ss"); QVERIFY(user2.lastLoginTime.get().toDateTime().toString(format) == datetime.toString(format)); QVERIFY(!user2.creationTime->isNull()); }
void tst_QScriptContext::inheritActivationAndThisObject() { QScriptEngine eng; eng.globalObject().setProperty("myEval", eng.newFunction(myEval)); { QScriptValue ret = eng.evaluate("var a = 123; myEval('a')"); QVERIFY(ret.isNumber()); QCOMPARE(ret.toInt32(), 123); } { QScriptValue ret = eng.evaluate("(function() { return myEval('this'); }).call(Number)"); QVERIFY(ret.isFunction()); QVERIFY(ret.equals(eng.globalObject().property("Number"))); } { QScriptValue ret = eng.evaluate("(function(a) { return myEval('a'); })(123)"); QVERIFY(ret.isNumber()); QCOMPARE(ret.toInt32(), 123); } // QT-2219 { eng.globalObject().setProperty("a", 123); QScriptValue ret = eng.evaluate("(function() { myEval('var a = 456'); return a; })()"); QVERIFY(ret.isNumber()); QCOMPARE(ret.toInt32(), 456); QEXPECT_FAIL("", "QT-2219: Wrong activation object is returned from native function's parent context", Continue); QVERIFY(eng.globalObject().property("a").strictlyEquals(123)); } }
void tst_ExpectFail::xfailOnAnyRow() const { // In a data-driven test, passing an empty first parameter to QEXPECT_FAIL // should mean that the failure is expected for all data rows. QEXPECT_FAIL("", "This test should xfail", Abort); QVERIFY(false); }
/* Test that vertical and horizontal mac-style scrollbars paint their entire area. */ void tst_MacGui::scrollbarPainting() { ColorWidget colorWidget; colorWidget.resize(400, 400); QSize scrollBarSize; QScrollBar verticalScrollbar(&colorWidget); verticalScrollbar.move(10, 10); scrollBarSize = verticalScrollbar.sizeHint(); scrollBarSize.setHeight(200); verticalScrollbar.resize(scrollBarSize); QScrollBar horizontalScrollbar(&colorWidget); horizontalScrollbar.move(30, 10); horizontalScrollbar.setOrientation(Qt::Horizontal); scrollBarSize = horizontalScrollbar.sizeHint(); scrollBarSize.setWidth(200); horizontalScrollbar.resize(scrollBarSize); colorWidget.show(); colorWidget.raise(); QTest::qWait(100); QPixmap pixmap = grabWindowContents(&colorWidget); QEXPECT_FAIL("", "QTBUG-26371", Abort); QVERIFY(isContent(pixmap.toImage(), verticalScrollbar.geometry(), GuiTester::Horizontal)); QVERIFY(isContent(pixmap.toImage(), horizontalScrollbar.geometry(), GuiTester::Vertical)); }
void tst_qdeclarativedebughelper::setAnimationSlowDownFactor() { TestAnimation animation; // first check whether setup works QCOMPARE(animation.updateCalled, 0); animation.start(); QTest::qWait(animation.totalDuration() + 50); #ifdef Q_OS_WIN if (animation.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort); #endif QCOMPARE(animation.state(), QAbstractAnimation::Stopped); QVERIFY(animation.updateCalled > 1); // check if we can pause all animations animation.updateCalled = 0; QDeclarativeDebugHelper::setAnimationSlowDownFactor(0.0); animation.start(); QTest::qWait(animation.totalDuration() + 50); QVERIFY(animation.updateCalled <= 1); // updateCurrentTime seems to be called at least once // now run them again animation.updateCalled = 0; QDeclarativeDebugHelper::setAnimationSlowDownFactor(2.0); animation.start(); QTest::qWait(animation.totalDuration() + 50); QVERIFY(animation.updateCalled > 1); }
void tst_QRawFont::fromFont() { QFETCH(QString, fileName); QFETCH(QFont::HintingPreference, hintingPreference); QFETCH(QString, familyName); QFETCH(QFontDatabase::WritingSystem, writingSystem); QFontDatabase fontDatabase; int id = fontDatabase.addApplicationFont(fileName); QVERIFY(id >= 0); QFont font(familyName); font.setHintingPreference(hintingPreference); font.setPixelSize(26.0); QRawFont rawFont = QRawFont::fromFont(font, writingSystem); QVERIFY(rawFont.isValid()); #ifdef Q_WS_QPA QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort); #endif QCOMPARE(rawFont.familyName(), familyName); QCOMPARE(rawFont.pixelSize(), 26.0); QVERIFY(fontDatabase.removeApplicationFont(id)); }
void ValgrindMemcheckParserTest::testValgrindStartError() { QFETCH(QString, valgrindExe); QFETCH(QStringList, valgrindArgs); QFETCH(QString, debuggee); QFETCH(QString, debuggeeArgs); ProjectExplorer::StandardRunnable debuggeeExecutable; debuggeeExecutable.executable = debuggee; debuggeeExecutable.environment = Utils::Environment::systemEnvironment(); debuggeeExecutable.commandLineArguments = debuggeeArgs; ValgrindRunner runner; runner.setValgrindExecutable(valgrindExe); runner.setValgrindArguments(valgrindArgs); runner.setDebuggee(debuggeeExecutable); runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice( ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)); RunnerDumper dumper(&runner); runner.start(); runner.waitForFinished(); QEXPECT_FAIL("", "Error codes of valgrind startup are currently unprocessed", Continue); //FIXME QVERIFY(dumper.m_errorReceived); // just finish without deadlock and we are fine }
void tst_QDirModel::task196768_sorting() { //this task showed that the persistent model indexes got corrupted when sorting QString path = SRCDIR; QDirModel model; /* QDirModel has a bug if we show the content of the subdirectory inside a hidden directory and we don't add QDir::Hidden. But as QDirModel is deprecated, we decided not to fix it. */ model.setFilter(QDir::AllEntries | QDir::Hidden | QDir::AllDirs); QTreeView view; QPersistentModelIndex index = model.index(path); view.setModel(&model); QModelIndex index2 = model.index(path); QCOMPARE(index.data(), index2.data()); view.setRootIndex(index); index2 = model.index(path); QCOMPARE(index.data(), index2.data()); view.setCurrentIndex(index); index2 = model.index(path); QCOMPARE(index.data(), index2.data()); view.setSortingEnabled(true); index2 = model.index(path); #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) QEXPECT_FAIL("", "QTBUG-43818", Continue); #endif QCOMPARE(index.data(), index2.data()); }
void tst_QDnsLookup::lookupAbortRetry() { QDnsLookup lookup; // try and abort the lookup lookup.setType(QDnsLookup::A); lookup.setName(domainName("a-single")); lookup.lookup(); lookup.abort(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); QCOMPARE(int(lookup.error()), int(QDnsLookup::OperationCancelledError)); QVERIFY(lookup.hostAddressRecords().isEmpty()); // retry a different lookup lookup.setType(QDnsLookup::AAAA); lookup.setName(domainName("aaaa-single")); lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); #if defined(Q_OS_ANDROID) if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) QEXPECT_FAIL("", "Not yet supported on Android", Abort); #endif QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:db8::1")); }
/* Test that the QSpinBox buttons are correctly positioned with the Mac style. */ void tst_MacGui::spinBoxArrowButtons() { ColorWidget colorWidget; colorWidget.resize(200, 200); QSpinBox spinBox(&colorWidget); QSpinBox spinBox2(&colorWidget); spinBox2.move(0, 100); colorWidget.show(); QTest::qWait(100); // Grab an unfocused spin box. const QImage noFocus = grabWindowContents(&colorWidget).toImage(); // Set focus by clicking the less button. QAccessibleInterface *lessInterface = wn.find(QAccessible::Name, "Less", &spinBox); QEXPECT_FAIL("", "QTBUG-26372", Abort); QVERIFY(lessInterface); const int delay = 500; clickLater(lessInterface, Qt::LeftButton, delay); const int timeout = 1; QTestEventLoop::instance().enterLoop(timeout); // Grab a focused spin box. const QImage focus = grabWindowContents(&colorWidget).toImage(); // Compare the arrow area of the less button to see if it moved. const QRect lessRect = lessInterface->rect(); const QRect lessLocalRect(colorWidget.mapFromGlobal(lessRect.topLeft()), colorWidget.mapFromGlobal(lessRect.bottomRight())); const QRect compareRect = lessLocalRect.adjusted(5, 3, -5, -7); QVERIFY(noFocus.copy(compareRect) == focus.copy(compareRect)); }
void EnvironmentVariableTest::testPersistentNonSystem() { #ifndef Q_OS_WIN QSKIP("This operation only works on Windows"); #endif KDUpdater::Application app; QString key = QLatin1String("IFW_TestKey"); QString value = QLatin1String("IFW_TestValue"); QInstaller::EnvironmentVariableOperation op; op.setArguments( QStringList() << key << value << QLatin1String("true") << QLatin1String("false")); const bool ok = op.performOperation(); QVERIFY2(ok, qPrintable(op.errorString())); // Verify now... QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Environment"), QSettings::NativeFormat); QVERIFY(value == settings.value(key).toString()); // Remove the setting QEXPECT_FAIL("", "Undo Operation not implemented yet", Continue); QVERIFY(op.undoOperation()); //QVERIFY(settings.value(key).toString().isEmpty()); settings.remove(key); }
void tst_QStaticText::rotatedPainter() { QPixmap imageDrawText(1000, 1000); imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.rotate(30.0); p.drawText(QRectF(0, 0, 1000, 100), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } QPixmap imageDrawStaticText(1000, 1000); imageDrawStaticText.fill(Qt::white); { QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.setTextFormat(Qt::PlainText); QPainter p(&imageDrawStaticText); p.rotate(30.0); p.drawStaticText(QPoint(0, 0), text); } #if defined(DEBUG_SAVE_IMAGE) imageDrawText.save("rotatedPainter_imageDrawText.png"); imageDrawStaticText.save("rotatedPainter_imageDrawStaticText.png"); #endif if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); }