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


C++ QFAIL函数代码示例

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


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

示例1: spy

void TestUpdater::updaterCopy()
{
    Updater u;
    u.setLocalRepository(dataCopy + "/local_repo");
    u.copy(testOutputCopy);
    QSignalSpy spy(&u, SIGNAL(copyFinished(bool)));
    QVERIFY(spy.wait());

    try {
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/patch_same.txt", testOutputCopy + "/patch_same.txt"));
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/path_diff.txt", testOutputCopy + "/path_diff.txt"));
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/path_diff2.txt", testOutputCopy + "/path_diff2.txt"));
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/rmfile.txt", testOutputCopy + "/rmfile.txt"));
    } catch(QString &msg) {
        QFAIL(msg.toLatin1());
    }
    QVERIFY(!QFile::exists(testOutputCopy + "/add.txt"));
}
开发者ID:Speedy37,项目名称:QtUpdateSystem,代码行数:18,代码来源:tst_updater.cpp

示例2: parseCourse

void XmlParserTest::parseTestCourse()
{
	ParseResult result;
	QString message;

	try
	{
		auto course = parseCourse(QStringLiteral(":/testing/courses/testcourse.xml"), *validator, &result,
		                     &message);

		verifyTestCourse(*course);
	}
	catch (Exception& e)
	{
		QFAIL(qUtf8Printable(e.message()));
	}

}
开发者ID:mNisblee,项目名称:QTouch,代码行数:18,代码来源:parser_test.cpp

示例3: qSort

void KisCrashFilterTest::testCrashFilters()
{
    QStringList failures;
    QStringList successes;

    QList<QString> filterList = KisFilterRegistry::instance()->keys();
    qSort(filterList);
    for (QList<QString>::Iterator it = filterList.begin(); it != filterList.end(); ++it) {
        if (testFilter(KisFilterRegistry::instance()->value(*it)))
            successes << *it;
        else
            failures << *it;
    }
    dbgKrita << "Success: " << successes;
    if (failures.size() > 0) {
        QFAIL(QString("Failed filters:\n\t %1").arg(failures.join("\n\t")).toLatin1());
    }
}
开发者ID:ChrisJong,项目名称:krita,代码行数:18,代码来源:kis_crash_filter_test.cpp

示例4: snippetFile

void JsonSnippetFileTest::savesEmptySnippetsCollectionToFile()
{
    QTemporaryFile snippetFile(this);
    if (!snippetFile.open())
        QFAIL("Failed to create temporary snippet file");

    SnippetCollection collection;
    bool success = JsonSnippetFile::save(snippetFile.fileName(), &collection);

    QVERIFY(success);

    QTextStream in(&snippetFile);
    QString fileContent = in.readAll().trimmed();

    QVERIFY(fileContent.startsWith("{"));
    QVERIFY(fileContent.contains("\"snippets\": ["));
    QVERIFY(fileContent.endsWith("}"));
}
开发者ID:CodingGears,项目名称:CuteMarkEd,代码行数:18,代码来源:jsonsnippetfiletest.cpp

示例5: QLoggingRule_parse

    void QLoggingRule_parse()
    {
        QFETCH(QString, pattern);
        QFETCH(QString, category);
        QFETCH(QtMsgType, msgType);
        QFETCH(LoggingRuleState, result);

        QLoggingRule rule(QStringRef(&pattern), true);
        LoggingRuleState state = Invalid;
        if (rule.flags != 0) {
            switch (rule.pass(category, msgType)) {
            case -1: QFAIL("Shoudn't happen, we set pattern to true"); break;
            case 0: state = NoMatch; break;
            case 1: state = Match; break;
            }
        }
        QCOMPARE(state, result);
    }
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:18,代码来源:tst_qloggingregistry.cpp

示例6: unknownTypeProvider

void TsFactory::TestMakeRetriever()
{
  try
  {
    terrama2::core::DataProvider unknownTypeProvider("dummy", terrama2::core::DataProvider::FTP_TYPE);
    terrama2::collector::DataRetrieverPtr retriever = terrama2::collector::Factory::makeRetriever(unknownTypeProvider);
    QVERIFY(retriever.get());

    terrama2::core::DataProvider ftpTypeProvider("dummy", terrama2::core::DataProvider::FTP_TYPE);
    retriever = terrama2::collector::Factory::makeRetriever(ftpTypeProvider);
    terrama2::collector::DataRetrieverFTP* retrieverFtp = dynamic_cast<terrama2::collector::DataRetrieverFTP*>(retriever.get());
    QVERIFY(retrieverFtp);
  }
  catch(...)
  {
    QFAIL(NO_EXCEPTION_EXPECTED);
  }
}
开发者ID:edelatin,项目名称:terrama2,代码行数:18,代码来源:TsFactory.cpp

示例7: qDebug

void GdalDataAccess::accessingFeatureData() {
    try {
        Ilwis::IFeatureCoverage fc;
        qDebug() << "Features : accessing data ";

        DOTEST(fc.prepare(makeInputPath("regions.shp")), "Loading regions.shp");
        QString env = fc->envelope().toString();
        DOTEST(env == "33.0065 3.40088 47.9605 14.9637","FeatureCoverage: testing envelope (bbox)");

        DOTEST(fc.prepare(makeInputPath("rainfall.shp")),"loading point map");
        Ilwis::FeatureIterator iter1(fc);

        Ilwis::SPFeatureI f1 = *(iter1 + 1);
        QVariant output = f1->cell("RAINFALL");
        DOTEST(output.toString() =="taquina","accesing attribute string data of pointmap");

        Ilwis::SPFeatureI f2 = *(iter1 + 4);
        output = f2("JANUARY");
        DOCOMPARE(output.toInt(), 85 ,"accesing attribute numeric data of pointmap");

        DOTEST(fc.prepare(makeInputPath("drainage.shp")),"loading segment map");
        Ilwis::FeatureIterator iter2(fc);

        Ilwis::SPFeatureI f3 = *(iter2 + 104);
        output = f3->cell("DRAINAGE");
        DOTEST(output.toString() == "lake","accesing attribute string data of line coverage");

        Ilwis::SPFeatureI f4 = *(iter2 + 21);
        output = f4("C1");
        DOCOMPARE(output.toInt(), 1 ,"accesing attribute numeric data ofline coverage");

        DOTEST(fc.prepare(makeInputPath("geology.shp")),"loading polygon map");
        Ilwis::FeatureIterator iter3(fc);

        Ilwis::SPFeatureI f5 = *(iter3 + 40);
        output = f5->cell("GEOLOGY");
        DOTEST(output.toString() == "Shales","accesing attribute string data of polygon coverage");


    }catch (const Ilwis::ErrorObject& err) {
        QString error = "Test threw exception : " + err.message();
        QFAIL(error.toLatin1());
    }
}
开发者ID:52North,项目名称:IlwisTests,代码行数:44,代码来源:gdaldataaccess.cpp

示例8: label

void VCLabel_Test::saveXML()
{
    QWidget w;

    VCLabel label(&w, m_doc);
    label.setCaption("Simo Kuassimo");

    QDomDocument xmldoc;
    QDomElement root = xmldoc.createElement("TestRoot");
    xmldoc.appendChild(root);

    QVERIFY(label.saveXML(&xmldoc, &root) == true);

    QDomNode node = root.firstChild();
    QVERIFY(node.nextSibling().isNull() == true);
    QCOMPARE(node.toElement().tagName(), QString("Label"));
    QCOMPARE(node.toElement().attribute("Caption"), QString("Simo Kuassimo"));
    QVERIFY(node.firstChild().isNull() == false);

    int appearance = 0, windowstate = 0;

    node = node.firstChild();
    while (node.isNull() == false)
    {
        QDomElement tag = node.toElement();
        if (tag.tagName() == QString("Appearance"))
        {
            appearance++;
        }
        else if (tag.tagName() == QString("WindowState"))
        {
            windowstate++;
        }
        else
        {
            QFAIL(QString("Unexpected XML tag: %1").arg(tag.tagName()).toUtf8().constData());
        }
        node = node.nextSibling();
    }

    QCOMPARE(appearance, 1);
    QCOMPARE(windowstate, 1);
}
开发者ID:Babbsdrebbler,项目名称:qlcplus,代码行数:43,代码来源:vclabel_test.cpp

示例9: QFETCH

void CMakeParserTest::testParserWithGoodData()
{
//    QFAIL( "the magic is missing" );
    QFETCH( QString, text );
    QTemporaryFile tempFile;
    tempFile.setAutoRemove( false );
    tempFile.open();
    if ( !QFile::exists( tempFile.fileName() ) )
        QFAIL( "Unable to open temporary file" );

    tempFile.write( text.toUtf8() );
    QString tempName = tempFile.fileName();
    tempFile.close(); //hacks to the get name of the file
//    CMakeAst* ast = new CMakeAst;
//    bool parseError = CMakeListsParser::parseCMakeFile( ast, qPrintable( tempName ) );
//    delete ast;
//    QVERIFY( parseError == false );
    tempFile.remove();
}
开发者ID:portaloffreedom,项目名称:kdev-golang-plugin,代码行数:19,代码来源:cmakeparsertest.cpp

示例10: xmlWriter

void QLCFixtureHead_Test::save()
{
    QLCFixtureHead head;
    head.addChannel(0);
    head.addChannel(1);
    head.addChannel(2);
    head.addChannel(3);

    QBuffer buffer;
    buffer.open(QIODevice::WriteOnly | QIODevice::Text);
    QXmlStreamWriter xmlWriter(&buffer);

    QVERIFY(head.saveXML(&xmlWriter));

    xmlWriter.setDevice(NULL);
    buffer.close();

    buffer.open(QIODevice::ReadOnly | QIODevice::Text);
    QXmlStreamReader xmlReader(&buffer);

    xmlReader.readNextStartElement();

    QCOMPARE(xmlReader.name().toString(), QString("Head"));
    int ch = 0;

    while (xmlReader.readNextStartElement())
    {
        if (xmlReader.name() == "Channel")
        {
            QString chNum = xmlReader.readElementText();
            QVERIFY(chNum.toInt() == 0 || chNum.toInt() == 1 ||
                    chNum.toInt() == 2 || chNum.toInt() == 3);
            ch++;
        }
        else
        {
            QFAIL(QString("Unexpected tag: %1").arg(xmlReader.name().toString()).toUtf8().constData());
            xmlReader.skipCurrentElement();
        }
    }

    QCOMPARE(ch, 4);
}
开发者ID:PML369,项目名称:qlcplus,代码行数:43,代码来源:qlcfixturehead_test.cpp

示例11: MyMoneyAccount

void onlineJobAdministrationTest::initTestCase()
{
  file = MyMoneyFile::instance();
  storage = new MyMoneySeqAccessMgr;
  file->attachStorage(storage);

  try {
    MyMoneyAccount account = MyMoneyAccount();
    account.setName("Test Account");
    account.setAccountType(MyMoneyAccount::Savings);
    MyMoneyAccount asset = file->asset();
    MyMoneyFileTransaction transaction;
    file->addAccount(account , asset);
    accountId = account.id();
    transaction.commit();
  } catch (const MyMoneyException& ex) {
    QFAIL(qPrintable("Unexpected exception " + ex.what()));
  }
}
开发者ID:CGenie,项目名称:kmymoney,代码行数:19,代码来源:onlinejobadministrationtest.cpp

示例12: QFETCH

void TestLVTS::test_LM35()
{
    QFETCH(int, read);
    QFETCH(double, temperature);

    LVTS lvts(1, SENSOR_LVTS_LM35);

    bool ok = false;

    //The value will always diff a little, so compare the rounded value...
    double value = round(lvts.lm35(read, &ok));
    if(!ok)
    {
        qDebug() << read << temperature << ok;
        QFAIL("convert failed");
    }

    QCOMPARE(temperature, value);
}
开发者ID:jsiei97,项目名称:FT_Sensor,代码行数:19,代码来源:TestLVTS.cpp

示例13: snippetFile

void JsonSnippetFileTest::roundtripTest()
{
    QTemporaryFile snippetFile(this);
    if (!snippetFile.open())
        QFAIL("Failed to create temporary snippet file");

    Snippet snippet1;
    snippet1.trigger = "abc";
    snippet1.description = "description abc";
    snippet1.snippet = "content abc";
    snippet1.cursorPosition = 0;
    snippet1.builtIn = true;

    Snippet snippet2;
    snippet2.trigger = "xyz";
    snippet2.description = "description xyz";
    snippet2.snippet = "content xyz";
    snippet2.cursorPosition = 1;
    snippet2.builtIn = false;

    SnippetCollection collection1;
    collection1.insert(snippet1);
    collection1.insert(snippet2);

    bool saveSuccess = JsonFile<Snippet>::save(snippetFile.fileName(), &collection1);
    QVERIFY(saveSuccess);

    SnippetCollection collection2;
    bool loadSuccess = JsonFile<Snippet>::load(snippetFile.fileName(), &collection2);
    QVERIFY(loadSuccess);

    QCOMPARE(collection2.count(), 2);

    QCOMPARE(collection2.snippet("abc").description, snippet1.description);
    QCOMPARE(collection2.snippet("abc").snippet, snippet1.snippet);
    QCOMPARE(collection2.snippet("abc").cursorPosition, snippet1.cursorPosition);
    QCOMPARE(collection2.snippet("abc").builtIn, snippet1.builtIn);

    QCOMPARE(collection2.snippet("xyz").description, snippet2.description);
    QCOMPARE(collection2.snippet("xyz").snippet, snippet2.snippet);
    QCOMPARE(collection2.snippet("xyz").cursorPosition, snippet2.cursorPosition);
    QCOMPARE(collection2.snippet("xyz").builtIn, snippet2.builtIn);
}
开发者ID:Bloodknight,项目名称:CuteMarkEd,代码行数:43,代码来源:jsonsnippetfiletest.cpp

示例14: directory

void AbstractTestSuite::initTestCase()
{
    if (!testsDir.exists()) {
        QString message = QString::fromLatin1("tests directory (%0) doesn't exist.")
                          .arg(testsDir.path());
        QFAIL(qPrintable(message));
        return;
    }

    if (QFileInfo(skipConfigPath).exists())
        TestConfigParser::parse(skipConfigPath, TestConfig::Skip, this);
    else
        createSkipConfigFile();

    if (QFileInfo(expectFailConfigPath).exists())
        TestConfigParser::parse(expectFailConfigPath, TestConfig::ExpectFail, this);
    else
        shouldGenerateExpectedFailures = true;
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:19,代码来源:abstracttestsuite.cpp

示例15: QFAIL

// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
void MenuStatesTest::ApplicationLibraryState_backSteppingAction()
{
#ifdef Q_OS_SYMBIAN
    User::ResetInactivityTime();//it should help for Viewserver11 panic
#ifdef UT_MEMORY_CHECK
    __UHEAP_MARK;
#endif//UT_MEMORY_CHECK
#endif//Q_OS_SYMBIAN
    {

        QFAIL("! Due to bug in hb wk36 we are forced to skip this test !");
        
        QScopedPointer<HbMainWindow> wind(new HbMainWindow);
        HsScene::setInstance( new HsScene(wind.data()) );
        //create statemachine to perform transitions
        QScopedPointer<QStateMachine> machine(new QStateMachine(0));

        HsAppLibraryState *appLibrary = new HsAppLibraryState(machine.data());

        machine->setInitialState(appLibrary);

        machine->start();

        qApp->sendPostedEvents();
        //initiate transition from collection state
        appLibrary->mCollectionState->openAppLibrary();

        qApp->sendPostedEvents();

        QVERIFY(appLibrary->mAllAppsState->mMenuView->view()->menu());
        machine->stop();
        qApp->removePostedEvents(0);
        disconnect(appLibrary,SIGNAL(initialize()),this,SLOT(appLibraryEntered()));

        qApp->processEvents();
    }
#ifdef Q_OS_SYMBIAN
#ifdef UT_MEMORY_CHECK
    __UHEAP_MARKEND;
#endif//UT_MEMORY_CHECK
#endif//Q_OS_SYMBIAN
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:46,代码来源:t_applibrarystate.cpp


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