Obsolete Members for QTest
クラスQTest の以下のメンバーは非推奨です。これらは古いソース・コードの動作を維持するために提供されています。新しいコードでは使用しないことを強くお勧めします。
関数
(deprecated in 6.4) bool | compare_helper(bool success, const char *failureMsg, char *actualVal, char *expectedVal, const char *actual, const char *expected, const char *file, int line) |
(deprecated in 6.3) void | qWarn(const char *message, const char *file = nullptr, int line = 0) |
マクロ
(deprecated in 6.3) | QVERIFY_EXCEPTION_THROWN(expression, exceptiontype) |
(deprecated) | QWARN(message) |
関数ドキュメント
[deprecated in 6.4] bool QTest::compare_helper(bool success, const char *failureMsg, char *actualVal, char *expectedVal, const char *actual, const char *expected, const char *file, int line)
この関数は6.4から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
この関数は、QTest::qCompare のさまざまな特殊化によって呼び出され、失敗を報告するかどうかを決定し、冗長なテスト出力を生成します。
failureMsg パラメータには null を指定でき、比較に失敗した場合はデフォルトのメッセージが出力されます。比較に成功した場合は、failureMsgは出力されない。
この関数を使用するのは最適ではありません。なぜなら、actualVal とexpectedVal の文字列表現を、比較に失敗した場合にのみ使用するにもかかわらず、事前に計算しておく必要があるからです。このような場合には、qxp::function_ref()を受け取るcompare_helper()オーバーロードを使用することを推奨する。
呼び出し元が比較された値を示すカスタム失敗メッセージを作成する場合、またはそれらの値が文字列化できない場合は、actualVal とexpectedVal パラメータを取らない関数のオーバーロードを使用します。
[deprecated in 6.3] void QTest::qWarn(const char *message, const char *file = nullptr, int line = 0)
この関数は6.3から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
代わりにqWarning() を使用してください。
マクロ・ドキュメント
[deprecated in 6.3] QVERIFY_EXCEPTION_THROWN(expression, exceptiontype)
このマクロは6.3以降非推奨です。新しいコードでは使用しないことを強くお勧めします。
代わりにQVERIFY_THROWS_EXCEPTION(exceptiontype, expression) を使用してください。
[deprecated] QWARN(message)
このマクロは非推奨である。新しいコードでは使用しないことを強く推奨する。
代わりにqWarning() を使用してください。
message をテストログに警告として追加します。このマクロはテストの任意の場所で使用できます。
注意:このマクロはスレッドセーフです。
© 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.