From e87eb577023c9b76cea241aa47cd3f53bfdef84b Mon Sep 17 00:00:00 2001 From: Jonas Kalinka Date: Fri, 16 Feb 2024 12:35:31 +0100 Subject: [PATCH 1/2] added qabstractitemmodeltester --- 027_tool.qabstractitemmodeltester.md | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 027_tool.qabstractitemmodeltester.md diff --git a/027_tool.qabstractitemmodeltester.md b/027_tool.qabstractitemmodeltester.md new file mode 100644 index 0000000..37f03e4 --- /dev/null +++ b/027_tool.qabstractitemmodeltester.md @@ -0,0 +1,35 @@ +# Tool Use QAbstractItemModelTester for Custom Models + +## Goals +Detect/Avoid a certain set of errors in subclasses of QAbstractItemModel. + +## Description +QAbstractItemModelTester can be used to detect common errors in the implementation of models based on QAbstractItemModel with very little effort and even before they appear in the form of a visible bug. + +## Environment +Qt + +## Platform +All + +## Implementation effort +Very minimal + +## Applicability +- When implementing new models +- As part of test suites +- In debug sessions + +## Caveats +Citing the [documentation](https://doc.qt.io/qt-5/qabstractitemmodeltester.html): + +> While QAbstractItemModelTester is a valid help for development and testing of custom item models, it does not (and cannot) catch all possible problems in QAbstractItemModel subclasses. Notably, it will never perform meaningful destructive testing of a model, which must be therefore tested separately. + +## See also + +## Implementation hints +QAbstractItemModelTester can be used in two ways: + +In unit tests +Directly in the running application (introduces testlib-dependency). Should be disabled for release builds. At least QAbstractItemModelTester::FailureReportingMode::Fatal should not be used in release builds +Both ways are described in the [documentation](https://doc.qt.io/qt-5/qabstractitemmodeltester.html) From 0aae1685bbf9cc31fcd8f203e0bccaf778dc6f4b Mon Sep 17 00:00:00 2001 From: Jonas Kalinka Date: Mon, 19 Feb 2024 18:00:33 +0100 Subject: [PATCH 2/2] removed 'tool' from title --- 027_tool.qabstractitemmodeltester.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/027_tool.qabstractitemmodeltester.md b/027_tool.qabstractitemmodeltester.md index 37f03e4..9dd0b5b 100644 --- a/027_tool.qabstractitemmodeltester.md +++ b/027_tool.qabstractitemmodeltester.md @@ -1,4 +1,4 @@ -# Tool Use QAbstractItemModelTester for Custom Models +# Use QAbstractItemModelTester for Custom Models ## Goals Detect/Avoid a certain set of errors in subclasses of QAbstractItemModel.