• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QFAIL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: QSKIP

void tst_Q3Dns::longTxtRecord()
{
    QSKIP("Long TXT records in Q3Dns don't work.", SkipSingle);

    int c = 0;
    char **v = 0;
    QCoreApplication a(c, v);

    Q3Dns dns(QString::fromLatin1("andreas.hanssen.name"), Q3Dns::Txt);
    QObject::connect(&dns, SIGNAL(resultsReady()), this, SLOT(longTxtRecordAnswer()));

    QTestEventLoop::instance().enterLoop(30);
    if (QTestEventLoop::instance().timeout())
	QFAIL("Network operation timed out");

    QStringList list = dns.texts();

    QCOMPARE(list.count(), 1);
    QCOMPARE(list[0], QString::fromLatin1("I have a remarkable solution to Fermat's last theorem, but it doesn't fit into this TXT record"));
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:20,代码来源:tst_q3dns.cpp


示例17: sender

/*!
 * \brief Use QPointer to check pointer in lambda.
 * QPointer is Qt's smart pointer, which become nullptr when
 * QObject's derived object is deleted. QPointer is copiable,
 * then when can copy it directly inside lambda.
 *
 * In lambda, we can just check pointer with assert, if the receiver
 * can have a shorter lifetime than sender, or 'if' statement if
 * receiver need to have a longer lifetime than sender.
 */
void ConnectLambdaTest::testCaseLambdaQPointer() {
  // create sender and receiver objects
  // use QPointer to check pointer before use
  QScopedPointer<Object> sender ( new Object );
  QPointer<Object> receiver ( new Object );

  // connect them with lambda
  connect(sender.data(), &Object::signalTest,
          [receiver](int value){ Q_ASSERT(receiver); receiver->setCheckValue(value); });

  // delete receiver
  delete receiver;

  // emit signal
  sender->emitSignal(0x800a);

  // can't test, receiver is nullptr
  // QCOMPARE(0x800a, receiver->checkValue());
  QFAIL("This test need to fail...");
}
开发者ID:GuillaumeBelz,项目名称:Qt-Connect-Lambda,代码行数:30,代码来源:tst_connectlambdatest.cpp


示例18: QVERIFY

void QLCFile_Test::getXMLHeader()
{
    bool insideCreatorTag = false, author = false, appname = false,
         appversion = false;
    QDomDocument doc;

    doc = QLCFile::getXMLHeader(QString());
    QVERIFY(doc.isNull() == true);

    doc = QLCFile::getXMLHeader("Settings");
    QVERIFY(doc.isNull() == false);
    QCOMPARE(doc.doctype().name(), QString("Settings"));

    QDomNode node(doc.firstChild());
    QCOMPARE(node.toElement().tagName(), QString("Settings"));
    node = node.firstChild();
    QCOMPARE(node.toElement().tagName(), QString("Creator"));
    node = node.firstChild();
    while (node.isNull() == false)
    {
        // Verify that program enters this while loop
        insideCreatorTag = true;

        QDomElement tag(node.toElement());
        if (tag.tagName() == KXMLQLCCreatorAuthor)
            author = true; // User might not have a full name so don't check the contents
        else if (tag.tagName() == KXMLQLCCreatorName)
            appname = true;
        else if (tag.tagName() == KXMLQLCCreatorVersion)
            appversion = true;
        else
            QFAIL(QString("Unrecognized tag: %1").arg(tag.tagName()).toUtf8().constData());

        node = node.nextSibling();
    }

    QCOMPARE(insideCreatorTag, true);
    QCOMPARE(author, true);
    QCOMPARE(appname, true);
    QCOMPARE(appversion, true);
}
开发者ID:OnceBe,项目名称:qlcplus,代码行数:41,代码来源:qlcfile_test.cpp


示例19: Q_FOREACH

void TaskStructureTests::mergeTaskListsTest_data()
{
    QTest::addColumn<TaskList>("old");
    QTest::addColumn<TaskList>("newTasks");
    QTest::addColumn<TaskList>("merged");

    Q_FOREACH (const QDomElement &testcase,
               TestHelpers::retrieveTestCases(QLatin1String(":/mergeTaskListsTest/Data"),
                                              QLatin1String("mergeTaskListsTest"))) {
        QString name = testcase.attribute(QStringLiteral("name"));

        QList<QDomElement> elements;
        elements << testcase.firstChildElement(Task::taskListTagName());
        elements << (elements.first()).nextSiblingElement(Task::taskListTagName());
        elements << (elements.at(1)).nextSiblingElement(Task::taskListTagName());
        bool oldFound = false, newFound = false, mergedFound = false;
        TaskList old, newTasks, merged;
        Q_FOREACH (const QDomElement &element, elements) {
            QString arg = element.attribute(QStringLiteral("arg"));
            TaskList tasks = Task::readTasksElement(element, CHARM_DATABASE_VERSION);
            if (arg == QLatin1String("old")) {
                old = tasks;
                oldFound = true;
            } else if (arg == QLatin1String("new")) {
                newTasks = tasks;
                newFound = true;
            } else if (arg == QLatin1String("merged")) {
                merged = tasks;
                qSort(merged.begin(), merged.end(), Task::lowerTaskId);
                mergedFound = true;
            } else {
                QFAIL("invalid XML structure in input data");
            }
        }
        QVERIFY(oldFound);
        QVERIFY(newFound);
        QVERIFY(mergedFound);

        QTest::newRow(name.toLocal8Bit().constData()) << old << newTasks << merged;
        qDebug() << "Added test case" << name;
    }
开发者ID:KDAB,项目名称:Charm,代码行数:41,代码来源:TaskStructureTests.cpp


示例20: switch

void ProjectModelTest::getProjectsTable(void) {
    try {
        WdgModels::ProjectsTableModel* w = Databases::ProjectDatabase::instance()->getProjectsTable(1);

        for(Project p : w->getProjects()) {
            switch(p.getId()) {
            case 9:
            case 14:
            case 47:
            case 48:
                QVERIFY(true);
                break;
            default:
                QVERIFY2(false, QString("Oups: "+QString::number(p.getId())).toStdString().c_str());
            }

        }
    } catch(DbException* e) {
        QFAIL(e->what());
    }
}
开发者ID:FACT-Team,项目名称:FactDev,代码行数:21,代码来源:projectmodeltest.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QFETCH函数代码示例发布时间:2022-05-30
下一篇:
C++ QEXPECT_FAIL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap