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

C++ QVERIFY2函数代码示例

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

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



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

示例1: QCOMPARE

void QtQuickSampleApplicationTest::myCalculatorViewModelOperationTest()
{
    // Setup the test
    MyCalculatorViewModelTest model;

    QCOMPARE( model.getOperation(), 0 ); //Expect the operation to be 'None' by default
    MyCalculatorViewModel::MyCalculator_Operation expect( MyCalculatorViewModel::MyCalculator_Operation::MyCalculator_Operation_Addition );
    model.injectOperation( expect );

    // Test - we're actually testing both the set and get method here, not as isolated as I would like but ok for what it is.
    int actual = model.getOperation();

    QVERIFY2( actual == (int)expect,
              QString("Expect the result value to be [%1] but actually got [%2] instead.").arg(expect).arg(actual).toStdString().c_str());
}
开发者ID:AzNBagel,项目名称:ImaginativeThinking_tutorials,代码行数:15,代码来源:QtQuickSampleApplicationTest.cpp


示例2: QVERIFY

void ctkMTAttrPasswordTestSuite::testAttributeTypePassword1()
{
  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd");
  QVERIFY(ocd);
  QList<ctkAttributeDefinitionPtr> ads = ocd->getAttributeDefinitions(ctkObjectClassDefinition::ALL);
  for (int i = 0; i < ads.size(); i++)
  {
    if (ads[i]->getID() == "password1")
    {
      QVERIFY2(ctkAttributeDefinition::PASSWORD == ads[i]->getType(),
               "Attribute type is not PASSWORD");
    }
  }
}
开发者ID:benoitbleuze,项目名称:CTK,代码行数:15,代码来源:ctkMTAttrPasswordTestSuite.cpp


示例3: QSKIP

void tst_QDirModel::unreadable()
{
#ifndef Q_OS_UNIX
    QSKIP("Test not implemented on non-Unixes");
#else
    // Create an empty file which has no read permissions (file will be removed by cleanup()).
    QFile unreadableFile(QDir::currentPath() + "qtest_unreadable");
    QVERIFY2(unreadableFile.open(QIODevice::WriteOnly | QIODevice::Text), qPrintable(unreadableFile.errorString()));
    unreadableFile.close();
    QVERIFY(unreadableFile.exists());
    QVERIFY2(unreadableFile.setPermissions(QFile::WriteOwner), qPrintable(unreadableFile.errorString()));

    // Check that we can't make a valid model index from an unreadable file.
    QDirModel model;
    QModelIndex index = model.index(QDir::currentPath() + "/qtest_unreadable");
    QVERIFY(!index.isValid());

    // Check that unreadable files are not treated like hidden files.
    QDirModel model2;
    model2.setFilter(model2.filter() | QDir::Hidden);
    index = model2.index(QDir::currentPath() + "/qtest_unreadable");
    QVERIFY(!index.isValid());
#endif
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:24,代码来源:tst_qdirmodel.cpp


示例4: QVERIFY2

void ctkEAScenario3EventConsumer::runTest()
{
  asynchMessages = 0;
  synchMessages = 0;
  /* create the hashtable to put properties in */
  ctkDictionary props;

  /* put service.pid property in hashtable */
  props.insert(ctkEventConstants::EVENT_TOPIC, topicsToConsume);

  /* register the service */
  serviceRegistration = context->registerService<ctkEventHandler>(this, props);

  QVERIFY2(serviceRegistration, "service registration should not be null");
}
开发者ID:benoitbleuze,项目名称:CTK,代码行数:15,代码来源:ctkEAScenario3TestSuite.cpp


示例5: name

void ZippedBufferTests::basictTest()
{
    QString name("toto.txt");
    QByteArray data;
    data.reserve(2);
    data[0] = 'a';
    data[1] = 'b';
    ZippedBuffer zbw(name, data);
    QTemporaryFile file;
    QVERIFY2(file.open(), "Cannot create file");
    QDataStream stream(&file);
    zbw.write(stream);
    file.close();
    {
        QFile read_file(file.fileName());
        QDataStream read_stream(&read_file);
        ZippedBuffer zbr;
        QVERIFY2(read_file.open(QIODevice::ReadOnly), "Cannot read file");
        zbr.read(read_stream);
        QVERIFY2(zbw.get_filename() == zbr.get_filename(), "Filename not equal");
        QVERIFY2(zbw.get_data() == zbr.get_data(), "Data not equal");
    }

}
开发者ID:rmarcou,项目名称:winzip-cpp,代码行数:24,代码来源:tst_zippedbuffertests.cpp


示例6: QFETCH

void tst_QLibrary::fileName()
{
    QFETCH( QString, libName);
    QFETCH( QString, expectedFilename);

    QLibrary lib(libName);
    bool ok = lib.load();
    QVERIFY2(ok, qPrintable(lib.errorString()));
#if defined(Q_OS_WIN)
    QCOMPARE(lib.fileName().toLower(), expectedFilename.toLower());
#else
    QCOMPARE(lib.fileName(), expectedFilename);
#endif
    QVERIFY(lib.unload());
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:15,代码来源:tst_qlibrary.cpp


示例7: QCOMPARE

void tst_QPauseAnimationJob::pauseResume()
{
    TestablePauseAnimation animation;
    animation.setDuration(400);
    animation.start();
    QCOMPARE(animation.state(), QAbstractAnimationJob::Running);
    QTest::qWait(200);
    animation.pause();
    QCOMPARE(animation.state(), QAbstractAnimationJob::Paused);
    animation.start();
    QTest::qWait(300);
    QTRY_VERIFY(animation.state() == QAbstractAnimationJob::Stopped);
    QVERIFY2(animation.m_updateCurrentTimeCount >= 3,
            QByteArrayLiteral("animation.m_updateCurrentTimeCount=") + QByteArray::number(animation.m_updateCurrentTimeCount));
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:15,代码来源:tst_qpauseanimationjob.cpp


示例8: locker

void ThreadedTestHTTPServer::run()
{
    TestHTTPServer server;
    {
        QMutexLocker locker(&m_mutex);
        QVERIFY2(server.listen(), qPrintable(server.errorString()));
        m_port = server.port();
        for (QHash<QString, TestHTTPServer::Mode>::ConstIterator i = m_dirs.constBegin();
                i != m_dirs.constEnd(); ++i) {
            server.serveDirectory(i.key(), i.value());
        }
        m_condition.wakeAll();
    }
    exec();
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:15,代码来源:testhttpserver.cpp


示例9: qDebug

void uiLoader::createBaseline()
{
    // can't use ftpUploadFile() here
    qDebug() << " ========== Uploading baseline of only the latest test values ";

    QFtp ftp;
    ftp.connectToHost( ftpHost );
    ftp.login( ftpUser, ftpPass );
    ftp.cd( ftpBaseDir );

    QDir dir( output );

    // Upload all the latest test results to the FTP server's baseline directory.
    QHashIterator<QString, QString> i(enginesToTest);
    while ( i.hasNext() ) {
        i.next();

        dir.cd( i.key() );
        ftp.cd( i.key() + ".baseline" );

        dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
        dir.setNameFilters( QStringList() << "*.png" );
        QFileInfoList list = dir.entryInfoList();

        dir.cd( ".." );

        for (int n = 0; n < list.size(); n++) {
            QFileInfo fileInfo = list.at( n );
            QFile file( QString( output ) + "/" + i.key() + "/" + fileInfo.fileName() );

            errorMsg = "could not open file " + fileInfo.fileName();
            QVERIFY2( file.open(QIODevice::ReadOnly), qPrintable(errorMsg));

            QByteArray fileData = file.readAll();
            file.close();

            ftp.put( fileData, fileInfo.fileName(), QFtp::Binary );
            qDebug() << "\t(I) Uploading:" << fileInfo.fileName() << "with file size" << fileData.size();
        }

        ftp.cd( ".." );
    }

    ftp.close();

    while ( ftp.hasPendingCommands() )
        QCoreApplication::instance()->processEvents();
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:48,代码来源:uiloader.cpp


示例10: QSKIP

void tst_QWinJumpList::testRecent()
{
    if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10)
        QSKIP("QTBUG-48751: Recent items do not work on Windows 10", Continue);
    QScopedPointer<QWinJumpList> jumplist(new QWinJumpList);
    QWinJumpListCategory *recent1 = jumplist->recent();
    QVERIFY(recent1);
    QVERIFY(!recent1->isVisible());
    QVERIFY(recent1->title().isEmpty());

    recent1->clear();
    QVERIFY(recent1->isEmpty());

    recent1->addItem(0);
    QVERIFY(recent1->isEmpty());

    recent1->setVisible(true);
    QVERIFY(recent1->isVisible());
    recent1->addLink(QStringLiteral("tst_QWinJumpList"), QCoreApplication::applicationFilePath());

    QTest::ignoreMessage(QtWarningMsg, "QWinJumpListCategory::addItem(): only tasks/custom categories support separators.");
    recent1->addSeparator();

    QTest::ignoreMessage(QtWarningMsg, "QWinJumpListCategory::addItem(): only tasks/custom categories support destinations.");
    recent1->addDestination(QCoreApplication::applicationDirPath());

    // cleanup the first jumplist instance and give the system a little time to update.
    // then test that another jumplist instance loads up the recent item(s) added above
    jumplist.reset();
    QTest::qWait(100);

    jumplist.reset(new QWinJumpList);
    QWinJumpListCategory *recent2 = jumplist->recent();
    QVERIFY(recent2);
    QCOMPARE(recent2->count(), 1);

    QWinJumpListItem* item = recent2->items().value(0);
    QVERIFY(item);
    const QString itemPath = item->filePath();
    const QString applicationFilePath = QCoreApplication::applicationFilePath();
    QVERIFY2(!itemPath.compare(applicationFilePath, Qt::CaseInsensitive),
             msgFileNameMismatch(itemPath, applicationFilePath));
    QEXPECT_FAIL("", "QWinJumpListItem::title not supported for recent items", Continue);
    QCOMPARE(item->title(), QStringLiteral("tst_QWinJumpList"));

    recent2->clear();
    QVERIFY(recent2->isEmpty());
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:48,代码来源:tst_qwinjumplist.cpp


示例11: while

void Test_Bone::testResolveDirection()
{
    Bone bone;

    bone.setLength(2.0);
    bone.mPos[1]->setX(1.5f);

    int sanity = 0;

    while(!bone.resolve()) {
        QVERIFY2(sanity < 100, "Bone never resolved.");
        sanity++;
    }

   // QVERIFY2(bone.mPos[1]->x() > 1.99, "bone is facing wrong way");
}
开发者ID:jhud,项目名称:abtsynth,代码行数:16,代码来源:tst_test_bone.cpp


示例12: QLatin1String

void KWalletExecuter::pamRead(const QString &value) const
{
    QDBusMessage msg =
        QDBusMessage::createMethodCall("org.kde.kwalletd", "/modules/kwalletd", "org.kde.KWallet", "readPassword");
    QVariantList args;
    args << m_handler
         << QLatin1String("Passwords")
         << QLatin1String("foo")
         << QLatin1String("buh");
    msg.setArguments(args);
    const QDBusMessage reply = QDBusConnection::sessionBus().call(msg);

    QVERIFY2(reply.type() != QDBusMessage::ErrorMessage, reply.errorMessage().toLocal8Bit());
    const QString password = reply.arguments().first().toString();
    QCOMPARE(password, value);
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:16,代码来源:kwalletexecuter.cpp


示例13: testForceThemeForTests

 void testForceThemeForTests()
 {
     auto forcedName = QStringLiteral("kitten");
     auto resolvedCurrent = KIconTheme::current();
     QVERIFY2(KIconTheme::current() != forcedName,
              "current theme initially expected to not be mangled");
     // Force a specific theme.
     KIconTheme::forceThemeForTests(forcedName);
     QCOMPARE(KIconTheme::current(), forcedName);
     // Reset override.
     KIconTheme::forceThemeForTests(QString());
     QCOMPARE(KIconTheme::current(), resolvedCurrent);
     // And then override again to make sure we still can.
     KIconTheme::forceThemeForTests(forcedName);
     QCOMPARE(KIconTheme::current(), forcedName);
 }
开发者ID:KDE,项目名称:kiconthemes,代码行数:16,代码来源:kicontheme_unittest.cpp


示例14: connect

void tst_QTimer::remainingTime()
{
    TimerHelper helper;
    QTimer timer;

    connect(&timer, SIGNAL(timeout()), &helper, SLOT(timeout()));
    timer.start(200);

    QCOMPARE(helper.count, 0);

    QTest::qWait(50);
    QCOMPARE(helper.count, 0);

    int remainingTime = timer.remainingTime();
    QVERIFY2(qAbs(remainingTime - 150) < 50, qPrintable(QString::number(remainingTime)));
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:16,代码来源:tst_qtimer.cpp


示例15: QNativeMouseMoveEvent

void tst_MacNativeEvents::testMouseMoveLocation()
{
    QWidget w;
    w.setMouseTracking(true);
    w.show();
    QPoint p = w.geometry().center();

    NativeEventList native;
    native.append(new QNativeMouseMoveEvent(p, Qt::NoModifier));

    ExpectedEventList expected(&w);
    expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(p), p, Qt::NoButton, Qt::NoButton, Qt::NoModifier));

    native.play();
    QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
}
开发者ID:KDE,项目名称:android-qt,代码行数:16,代码来源:tst_macnativeevents.cpp


示例16: l_name1

void tst_QLogSystem::loggerConstruction()
{
    FileLogger<> l_name1("NO-DIRECTORY/file-should-not-be-opened");
    QString err_msg;
    QVERIFY2(!l_name1.isReady(err_msg), "File logger is ready with invalid dir.");
    QVERIFY2(!err_msg.isEmpty(), "File logger has not obtained error message");

    err_msg = QString("");

    FileLogger<> l_name2("./LoggersTest.log");
    QVERIFY2(l_name2.isReady(err_msg), "File logger is not ready with local dir.");
    QVERIFY2(err_msg.isEmpty(), "File logger has obtained error message with local dir");
    QVERIFY2(QFile::remove("./LoggersTest.log"), "could not delete log file");

    FileLogger<> l_name3(stdout);
    QVERIFY2(l_name3.isReady(err_msg), "File logger is not ready with stdout.");
    QVERIFY2(err_msg.isEmpty(), "File logger has obtained error message with stdout.");

    FileLogger<> l_name4(stderr);
    QVERIFY2(l_name4.isReady(err_msg), "File logger is not ready with stderr.");
    QVERIFY2(err_msg.isEmpty(), "File logger has obtained error message with stderr.");
}
开发者ID:qt-labs,项目名称:messagingframework,代码行数:22,代码来源:tst_qlogsystem.cpp


示例17: matrix

void Physics_testTest::testCase1()
{
  Matrix3f matrix(Matrix3f::kZero);
  Matrix3f identity(Matrix3f::kIdentity);

  Matrix3f sum(identity + identity);
  Matrix3f sum2 = identity * 2.0f;

  QVERIFY2(sum2 - sum == Matrix3f::kZero, "Sum" );
  QVERIFY2(sum2.det() == 8.0f, "Det");

  Matrix3f inverse = sum2.inverse();
  QVERIFY2(inverse.det() - (1.0f/8.0f) < 0.01f, "Inverse");
  QVERIFY2(inverse*sum2 == Matrix3f::kIdentity, "Inverse2");

  Matrix3f rotX = Matrix3f::RotationX(0.1);
  Matrix3f rotY = Matrix3f::RotationY(0.5);
  Matrix3f rotZ = Matrix3f::RotationZ(2.0);

  Matrix3f total = rotX * rotY * rotZ;

  QVERIFY2(fabs(((total * total.inverse()) - Matrix3f::kIdentity).det()) < 0.00000001f, "Complex");

  Vector3f y_up = Vector3f(0.0f, 1.0f, 0.0f);
  Vector3f x_right = Vector3f(1.0f, 0.0f, 0.0f);

  Vector3f imageY = rotX * y_up;
  QVERIFY2(fabs(imageY.dot(y_up) - cosf(0.1f)) < 0.00001, "Rotation");

  Matrix3f rot_axis = Matrix3f::FromAxisAngle(y_up, 0.5);
  Vector3f imageX = rot_axis * y_up;
  QVERIFY2(fabs(imageX.dot(y_up) - y_up.lengthSquared()) < 0.00001, "Axis Angle");

  imageX = rot_axis * x_right;
  QVERIFY2(fabs(imageX.dot(x_right) - cosf(0.5)) < 0.00001, "Axis Angle");

  //Matrix3f identity = Matrix3f::kIdentity;
  QVERIFY2(true, "Failure");
}
开发者ID:zap-twiz,项目名称:twiz-code,代码行数:39,代码来源:tst_physics_testtest.cpp


示例18: ensureSerializesCorrectly

void ensureSerializesCorrectly(const QPicture &picture, QDataStream::Version version)
 {
    QDataStream stream;

    QBuffer buffer;
    buffer.open(QIODevice::WriteOnly);
    stream.setDevice(&buffer);
    stream.setVersion(version);
    stream << picture;
    buffer.close();

    buffer.open(QIODevice::ReadOnly);
    QPicture readpicture;
    stream >> readpicture;
    QVERIFY2(memcmp(picture.data(), readpicture.data(), picture.size()) == 0,
        qPrintable(QString::fromLatin1("Picture data does not compare equal for QDataStream version %1").arg(version)));
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:17,代码来源:tst_qpicture.cpp


示例19: tar

void KArchiveTest::testTarRootDir() // bug 309463
{
    KTar tar(QFINDTESTDATA(QLatin1String("tar_rootdir.tar.gz")));
    QVERIFY2(tar.open(QIODevice::ReadOnly), qPrintable(tar.fileName()));

    const KArchiveDirectory *dir = tar.directory();
    QVERIFY(dir != nullptr);

    const QStringList listing = recursiveListEntries(dir, QLatin1String(""), WithUserGroup);
    //qDebug() << listing.join("\n");

    QVERIFY(listing[0].contains("%{APPNAME}.cpp"));
    QVERIFY(listing[1].contains("%{APPNAME}.h"));
    QVERIFY(listing[5].contains("main.cpp"));

    QCOMPARE(listing.count(), 10);
}
开发者ID:barcelonascience,项目名称:karchive,代码行数:17,代码来源:karchivetest.cpp


示例20: testWLAN6X

 void testWLAN6X() {
     Keygen * keygen = matcher.getKeygen("WLAN123456", "11:22:33:44:55:66", 0, "");
     QVERIFY2(keygen != NULL, "An algorithm was not detected");
     QCOMPARE(typeid(*keygen),typeid(Wlan6Keygen) );
     QVector<QString> results = keygen->getResults();
     QCOMPARE( results.size(),10);
     QCOMPARE(results.at(0), QString("5630556304607"));
     QCOMPARE(results.at(1), QString("5730446305616"));
     QCOMPARE(results.at(2), QString("5430776306625"));
     QCOMPARE(results.at(3), QString("5530666307634"));
     QCOMPARE(results.at(4), QString("5230116300643"));
     QCOMPARE(results.at(5), QString("5330006301652"));
     QCOMPARE(results.at(6), QString("5030336302661"));
     QCOMPARE(results.at(7), QString("5130226303670"));
     QCOMPARE(results.at(8), QString("5E30DD630C68F"));
     QCOMPARE(results.at(9), QString("5F30CC630D69E"));
 }
开发者ID:cooky85,项目名称:routerkeygen,代码行数:17,代码来源:AlgorithmsTest.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ QVariant函数代码示例发布时间:2022-05-30
下一篇:
C++ QVERIFY函数代码示例发布时间: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