这篇教程C++ testFileUrl函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中testFileUrl函数的典型用法代码示例。如果您正苦于以下问题:C++ testFileUrl函数的具体用法?C++ testFileUrl怎么用?C++ testFileUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了testFileUrl函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: testFileUrlvoid tst_qqmlenginecleanup::test_valueTypeProviderModule(){ // this test ensures that a module which installs a value type // provider can be reinitialized after multiple calls to // qmlClearTypeRegistrations() without causing cycles in the // value type provider list. QQmlEngine *e = 0; QUrl testFile1 = testFileUrl("testFile1.qml"); QUrl testFile2 = testFileUrl("testFile2.qml"); bool noCycles = false; for (int i = 0; i < 20; ++i) { cleanState(&e); QQmlComponent c(e, this); c.loadUrl(i % 2 == 0 ? testFile1 : testFile2); // this will hang if cycles exist. } delete e; e = 0; noCycles = true; QVERIFY(noCycles); // this test ensures that no crashes occur due to using // a dangling QQmlType pointer in the type compiler // which results from qmlClearTypeRegistrations() QUrl testFile3 = testFileUrl("testFile3.qml"); bool noDangling = false; for (int i = 0; i < 20; ++i) { cleanState(&e); QQmlComponent c(e, this); c.loadUrl(i % 2 == 0 ? testFile1 : testFile3); // this will crash if dangling ptr exists. } delete e; noDangling = true; QVERIFY(noDangling);}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:34,
示例2: component// QTBUG-17324void tst_qdeclarativemoduleplugin::importsMixedQmlCppPlugin(){ QDeclarativeEngine engine; engine.addImportPath(importsDirectory()); { QDeclarativeComponent component(&engine, testFileUrl("importsMixedQmlCppPlugin.qml")); QObject *o = component.create(); QVERIFY2(o, msgComponentError(component, &engine).constData()); QCOMPARE(o->property("test").toBool(), true); delete o; } { QDeclarativeComponent component(&engine, testFileUrl("importsMixedQmlCppPlugin.2.qml")); QObject *o = component.create(); QVERIFY(o != 0); QCOMPARE(o->property("test").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); delete o; }}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:27,
示例3: QStringLiteralvoid tst_qqmltranslation::translation_data(){ QTest::addColumn<QString>("translation"); QTest::addColumn<QUrl>("testFile"); QTest::addColumn<bool>("verifyCompiledData"); QTest::newRow("qml") << QStringLiteral("qml_fr") << testFileUrl("translation.qml") << true; QTest::newRow("qrc") << QStringLiteral(":/qml_fr.qm") << QUrl("qrc:/translation.qml") << true; QTest::newRow("js") << QStringLiteral("qml_fr") << testFileUrl("jstranslation.qml") << false;}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:10,
示例4: QQuickWidgetvoid tst_qquickwidget::reparentAfterShow(){ QWidget window; QQuickWidget *childView = new QQuickWidget(&window); childView->setSource(testFileUrl("rectangle.qml")); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window, 5000)); QScopedPointer<QQuickWidget> toplevelView(new QQuickWidget); toplevelView->setParent(&window); toplevelView->setSource(testFileUrl("rectangle.qml")); toplevelView->show(); QVERIFY(QTest::qWaitForWindowExposed(&window, 5000));}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:15,
示例5: cvoid tst_qqmlexpression::scriptString(){ qmlRegisterType<TestObject>("Test", 1, 0, "TestObject"); QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("scriptString.qml")); TestObject *testObj = qobject_cast<TestObject*>(c.create()); QVERIFY(testObj != 0); QQmlScriptString script = testObj->scriptString(); QVERIFY(!script.isEmpty()); QQmlExpression expression(script); QVariant value = expression.evaluate(); QCOMPARE(value.toInt(), 15); QQmlScriptString scriptError = testObj->scriptStringError(); QVERIFY(!scriptError.isEmpty()); //verify that the expression has the correct error location information QQmlExpression expressionError(scriptError); QVariant valueError = expressionError.evaluate(); QVERIFY(!valueError.isValid()); QVERIFY(expressionError.hasError()); QQmlError error = expressionError.error(); QCOMPARE(error.url(), c.url()); QCOMPARE(error.line(), 8);}
开发者ID:SamuelNevala,项目名称:qtdeclarative,代码行数:28,
示例6: cvoid tst_QuickPath::catmullromCurve(){ QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("curve.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); QVERIFY(obj != 0); QCOMPARE(obj->startX(), 0.); QCOMPARE(obj->startY(), 0.); QQmlListReference list(obj, "pathElements"); QCOMPARE(list.count(), 3); QQuickPathCatmullRomCurve* curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(0)); QVERIFY(curve != 0); QCOMPARE(curve->x(), 100.); QCOMPARE(curve->y(), 50.); curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(2)); QVERIFY(curve != 0); QCOMPARE(curve->x(), 100.); QCOMPARE(curve->y(), 150.); QPainterPath path = obj->path(); QVERIFY(path != QPainterPath()); QPointF pos = obj->pointAt(0); QCOMPARE(pos, QPointF(0,0)); pos = obj->pointAt(.25); QCOMPARE(pos.toPoint(), QPoint(63,26)); //fuzzy compare pos = obj->pointAt(.75); QCOMPARE(pos.toPoint(), QPoint(51,105)); //fuzzy compare pos = obj->pointAt(1); QCOMPARE(pos.toPoint(), QPoint(100,150));}
开发者ID:xjohncz,项目名称:qt5,代码行数:35,
示例7: cvoid tst_qqmlmetatype::compositeType(){ QQmlEngine engine; //Loading the test file also loads all composite types it imports QQmlComponent c(&engine, testFileUrl("testImplicitComposite.qml")); QObject* obj = c.create(); QVERIFY(obj); QQmlType *type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0); QVERIFY(type); QVERIFY(type->module() == QLatin1String("")); QVERIFY(type->elementName() == QLatin1String("ImplicitType")); QCOMPARE(type->qmlTypeName(), QLatin1String("ImplicitType")); QCOMPARE(type->sourceUrl(), testFileUrl("ImplicitType.qml"));}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:16,
示例8: QVERIFYvoid tst_qquickwidget::renderingSignals(){ QQuickWidget widget; QQuickWindow *window = widget.quickWindow(); QVERIFY(window); QSignalSpy beforeRenderingSpy(window, &QQuickWindow::beforeRendering); QSignalSpy beforeSyncSpy(window, &QQuickWindow::beforeSynchronizing); QSignalSpy afterRenderingSpy(window, &QQuickWindow::afterRendering); QVERIFY(beforeRenderingSpy.isValid()); QVERIFY(beforeSyncSpy.isValid()); QVERIFY(afterRenderingSpy.isValid()); QCOMPARE(beforeRenderingSpy.size(), 0); QCOMPARE(beforeSyncSpy.size(), 0); QCOMPARE(afterRenderingSpy.size(), 0); widget.setSource(testFileUrl("rectangle.qml")); QCOMPARE(beforeRenderingSpy.size(), 0); QCOMPARE(beforeSyncSpy.size(), 0); QCOMPARE(afterRenderingSpy.size(), 0); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget, 5000)); QTRY_VERIFY(beforeRenderingSpy.size() > 0); QTRY_VERIFY(beforeSyncSpy.size() > 0); QTRY_VERIFY(afterRenderingSpy.size() > 0);}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:31,
示例9: windowvoid tst_QQuickAccessible::ignoredTest(){ QScopedPointer<QQuickView> window(new QQuickView()); window->setSource(testFileUrl("ignored.qml")); window->show(); QQuickItem *contentItem = window->contentItem(); QVERIFY(contentItem); QQuickItem *rootItem = contentItem->childItems().first(); QVERIFY(rootItem); // the window becomes active QAccessible::State activatedChange; activatedChange.active = true; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window.data()); QVERIFY(iface); QAccessibleInterface *rectangleA = iface->child(0); QCOMPARE(rectangleA->role(), QAccessible::StaticText); QCOMPARE(rectangleA->text(QAccessible::Name), QLatin1String("A")); static const char *expected = "BEFIHD"; // check if node "C" and "G" is skipped and that the order is as expected. for (int i = 0; i < rectangleA->childCount(); ++i) { QAccessibleInterface *child = rectangleA->child(i); QCOMPARE(child->text(QAccessible::Name), QString(QLatin1Char(expected[i]))); } QTestAccessibility::clearEvents();}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:29,
示例10: hitTestvoid tst_QQuickAccessible::hitTest(){ QQuickView *window = new QQuickView; window->setSource(testFileUrl("hittest.qml")); window->show(); QAccessibleInterface *windowIface = QAccessible::queryAccessibleInterface(window); QVERIFY(windowIface); QAccessibleInterface *rootItem = windowIface->child(0); QRect rootRect = rootItem->rect(); // check the root item from app QAccessibleInterface *appIface = QAccessible::queryAccessibleInterface(qApp); QVERIFY(appIface); QAccessibleInterface *itemHit = appIface->childAt(rootRect.x() + 200, rootRect.y() + 50); QVERIFY(itemHit); QCOMPARE(itemHit->rect(), rootRect); QAccessibleInterface *rootItemIface; for (int c = 0; c < rootItem->childCount(); ++c) { QAccessibleInterface *iface = rootItem->child(c); QString name = iface->text(QAccessible::Name); if (name == QLatin1String("rect1")) { // hit rect1 QAccessibleInterface *rect1 = iface; QRect rect1Rect = rect1->rect(); QAccessibleInterface *rootItemIface = rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10); QVERIFY(rootItemIface); QCOMPARE(rect1Rect, rootItemIface->rect()); QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect1")); // should also work from top level (app) QAccessibleInterface *app(QAccessible::queryAccessibleInterface(qApp)); QAccessibleInterface *itemHit2(topLevelChildAt(app, rect1Rect.x() + 10, rect1Rect.y() + 10)); QVERIFY(itemHit2); QCOMPARE(itemHit2->rect(), rect1Rect); QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1")); } else if (name == QLatin1String("rect2")) { QAccessibleInterface *rect2 = iface; // FIXME: This is seems broken on OS X // QCOMPARE(rect2->rect().translated(rootItem->rect().x(), rootItem->rect().y()), QRect(0, 50, 100, 100)); QAccessibleInterface *rect20 = rect2->child(0); QVERIFY(rect20); QCOMPARE(rect20->text(QAccessible::Name), QLatin1String("rect20")); QPoint p = rect20->rect().bottomRight() + QPoint(20, 20); QAccessibleInterface *rect201 = rect20->childAt(p.x(), p.y()); QVERIFY(rect201); QCOMPARE(rect201->text(QAccessible::Name), QLatin1String("rect201")); rootItemIface = topLevelChildAt(windowIface, p.x(), p.y()); QVERIFY(rootItemIface); QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect201")); } } delete window; QTestAccessibility::clearEvents();}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:58,
示例11: QVERIFYvoid tst_QQuickView::errors(){ QQuickView *view = new QQuickView; QVERIFY(view); QQmlTestMessageHandler messageHandler; view->setSource(testFileUrl("error1.qml")); QVERIFY(view->status() == QQuickView::Error); QVERIFY(view->errors().count() == 1); delete view;}
开发者ID:ghjinlei,项目名称:qt5,代码行数:10,
示例12: cleanupViewvoid tst_qquickwidget::errors(){ QQuickWidget *view = new QQuickWidget; QScopedPointer<QQuickWidget> cleanupView(view); QQmlTestMessageHandler messageHandler; view->setSource(testFileUrl("error1.qml")); QVERIFY(view->status() == QQuickWidget::Error); QVERIFY(view->errors().count() == 1);}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:10,
示例13: errorsvoid tst_QQuickView::errors(){ { QQuickView view; QQmlTestMessageHandler messageHandler; view.setSource(testFileUrl("error1.qml")); QVERIFY(view.status() == QQuickView::Error); QVERIFY(view.errors().count() == 1); }}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:10,
示例14: componentvoid tst_qtqmlmodules::unavailableTypes(){ QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("unavailable.qml")); QObject *object = component.create(); QVERIFY(object != 0); QVERIFY(object->property("success").toBool()); delete object;}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:10,
示例15: QFETCHvoid tst_qdeclarativemoduleplugin::versionNotInstalled(){ QFETCH(QString, file); QFETCH(QString, errorFile); QDeclarativeEngine engine; engine.addImportPath(importsDirectory()); QDeclarativeComponent component(&engine, testFileUrl(file)); VERIFY_ERRORS(errorFile.toLatin1().constData());}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:11,
示例16: componentvoid tst_qqmlvaluetypeproviders::jsObjectConversion(){ QQmlEngine e; QQmlComponent component(&e, testFileUrl("jsObjectConversion.qml")); QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QObject *object = component.create(); QVERIFY(object != 0); QVERIFY(object->property("qtquickTypeSuccess").toBool()); delete object;}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:11,
示例17: QQuickViewvoid tst_qquickspritesequence::test_spriteAfterGoal(){ QQuickView *window = new QQuickView(0); window->setSource(testFileUrl("spriteaftergoal.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); //verify: Don't crash delete window;}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:11,
示例18: hitTestvoid tst_QQuickAccessible::hitTest(){ QQuickView *window = new QQuickView; window->setSource(testFileUrl("hittest.qml")); window->show(); QAccessibleInterface *windowIface = QAccessible::queryAccessibleInterface(window); QVERIFY(windowIface); QAccessibleInterface *rootItem = windowIface->child(0); QRect rootRect = rootItem->rect(); // check the root item from app QAccessibleInterface *appIface = QAccessible::queryAccessibleInterface(qApp); QVERIFY(appIface); QAccessibleInterface *itemHit(appIface->childAt(rootRect.x() + 200, rootRect.y() + 50)); QVERIFY(itemHit); QCOMPARE(rootRect, itemHit->rect()); // hit rect1 QAccessibleInterface *rect1(rootItem->child(0)); QRect rect1Rect = rect1->rect(); QAccessibleInterface *rootItemIface = rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10); QVERIFY(rootItemIface); QCOMPARE(rect1Rect, rootItemIface->rect()); QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect1")); // should also work from top level (app) QAccessibleInterface *app(QAccessible::queryAccessibleInterface(qApp)); QAccessibleInterface *itemHit2(topLevelChildAt(app, rect1Rect.x() + 10, rect1Rect.y() + 10)); QVERIFY(itemHit2); QCOMPARE(itemHit2->rect(), rect1Rect); QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1")); // hit rect201 QAccessibleInterface *rect2(rootItem->child(1)); QVERIFY(rect2); // FIXME: This is seems broken on mac // QCOMPARE(rect2->rect().translated(rootItem->rect().x(), rootItem->rect().y()), QRect(0, 50, 100, 100)); QAccessibleInterface *rect20(rect2->child(0)); QVERIFY(rect20); QAccessibleInterface *rect201(rect20->child(1)); QVERIFY(rect201); QRect rect201Rect = rect201->rect(); rootItemIface = windowIface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20); QVERIFY(rootItemIface); QCOMPARE(rootItemIface->rect(), rect201Rect); QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect201")); delete window; QTestAccessibility::clearEvents();}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:52,
示例19: componentvoid tst_qqmllistreference::variantToList(){ QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("variantToList.qml")); QObject *o = component.create(); QVERIFY(o); QVERIFY(o->property("value").userType() == qMetaTypeId<QQmlListReference>()); QCOMPARE(o->property("test").toInt(), 1); delete o;}
开发者ID:ghjinlei,项目名称:qt5,代码行数:13,
注:本文中的testFileUrl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ testFinish函数代码示例 C++ testError函数代码示例 |