Obsolete Members for TestCase

QML 类型TestCase的以下成员已被废弃。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议不要在新代码中使用它们。

属性

方法

物业文件

optional : bool [deprecated in 6.12]

自 QtTest 6.12 起,该属性已被废弃。我们强烈建议不要在新代码中使用它。

请改用 `skip()`。

在测试应用程序中可以提供多个 `TestCase ` 类型。一旦所有测试用例均已完成,应用程序将退出。如果某个测试用例无需运行(例如因为先决条件未通过),则可将此属性设置为 `true`。默认值为 `false`。

TestCase {
    when: false
    optional: true
    function test_not_run() {
        verify(false)
    }
}

另请参阅 when 和completed 。


方法文档

[deprecated in 6.5] bool waitForItemPolished(object item, int timeout = 5000)

自 QtTest 6.5 起,此方法已被废弃。我们强烈建议不要在新代码中使用它。

请改用 `waitForPolish()`。

等待timeout 毫秒,或者直到对item 调用了updatePolish()。

如果在timeout 毫秒内对item 调用了updatePolish() ,则返回true ;否则返回false 。

另请参阅 isPolishScheduled()、QQuickItem::polish() 和QQuickItem::updatePolish()。


© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.