当前位置: 首页>>代码示例>>C++>>正文


C++ QEXPECT_FAIL函数代码示例

本文整理汇总了C++中QEXPECT_FAIL函数的典型用法代码示例。如果您正苦于以下问题:C++ QEXPECT_FAIL函数的具体用法?C++ QEXPECT_FAIL怎么用?C++ QEXPECT_FAIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了QEXPECT_FAIL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testGetQuotaRoot

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();
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:35,代码来源:quotarootjobtest.cpp

示例2: QFETCH

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);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:27,代码来源:tst_qpauseanimationjob.cpp

示例3: QSKIP

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));
}
开发者ID:oneywang,项目名称:qtbase,代码行数:28,代码来源:tst_qnumeric.cpp

示例4: pies

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() );
}
开发者ID:militia11,项目名称:Schronisko,代码行数:25,代码来源:tst_schroniskotesty.cpp

示例5: klient

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() );
}
开发者ID:militia11,项目名称:Schronisko,代码行数:25,代码来源:tst_schroniskotesty.cpp

示例6: QEXPECT_FAIL

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);
}
开发者ID:Suneal,项目名称:qt,代码行数:27,代码来源:tst_strcmp.cpp

示例7: commandData

    void commandData() {
        QFETCH(bool, pass);

        QEXPECT_FAIL("row2", "expectedFailureData1", Abort);
        QVERIFY2(pass, "fail");

        QEXPECT_FAIL("row3", "expectedFailureData2", Continue);
        QVERIFY(pass);
    }
开发者ID:KDE,项目名称:kdev-xtest,代码行数:9,代码来源:expectedFailure.cpp

示例8: QEXPECT_FAIL

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);
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:10,代码来源:tst_expectfail.cpp

示例9: QVERIFY

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"));

}
开发者ID:dbrnz,项目名称:PythonQtCopy,代码行数:54,代码来源:PythonQtTests.cpp

示例10: qDebug

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");
}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:11,代码来源:tst_foo.cpp

示例11: qDebug

void tst_ExpectFail::expectAndAbort() const
{
    qDebug("begin");
    QEXPECT_FAIL("", "This should xfail", Abort);
    QVERIFY(false);
    qDebug("this should not be reached");
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:7,代码来源:tst_expectfail.cpp

示例12: imageDrawText

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);
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:27,代码来源:tst_qstatictext.cpp

示例13: spy

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);
}
开发者ID:arcan1s,项目名称:awesome-widgets,代码行数:25,代码来源:testextweather.cpp

示例14: defined

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
}
开发者ID:maxxant,项目名称:qt,代码行数:25,代码来源:tst_qtextscriptengine.cpp

示例15: s

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);
        }
}
开发者ID:maxxant,项目名称:qt,代码行数:31,代码来源:tst_qtextscriptengine.cpp


注:本文中的QEXPECT_FAIL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。