Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit e73a870

Browse files
committed
added modeltest to example
1 parent 6c5f017 commit e73a870

File tree

8 files changed

+1023
-0
lines changed

8 files changed

+1023
-0
lines changed

examples/3rdparty/LICENSE.GPL

Lines changed: 342 additions & 0 deletions
Large diffs are not rendered by default.

examples/3rdparty/README.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<html>
2+
<body>
3+
<p>
4+
ModelTest provides a way to check for common errors in implementations of <a href="QAbstractItemModel">http://doc.trolltech.com/4/qabstractitemmodel.html</a>.
5+
</p>
6+
<p>
7+
ModelTest continuously checks a model as it changes, helping to verify the state and catching many common errors the moment they show up such as: </p>
8+
<ul>
9+
<li>Verifing X number of rows have been inserted in the correct place after the signal rowsAboutToBeInserted() says X rows will be inserted.</li>
10+
<li>The parent of the first index of the first row is a QModelIndex()</li>
11+
<li>Calling index() twice in a row with the same values will return the same QModelIndex</li>
12+
<li>If rowCount() says there are X number of rows, model test will verify that is true.
13+
<li>Many possible off by one bugs</li>
14+
<li>hasChildren() returns true if rowCount() is greater then zero.</li>
15+
<li>and many more...</li>
16+
</ul>
17+
18+
19+
20+
<p> To Use the model test do the following: </p>
21+
<ol>
22+
<li> Include the pri file at the end of your project pro file using the include() command like so:
23+
<pre>
24+
include(../path/to/dir/modeltest.pri)
25+
</pre>
26+
</li>
27+
<li> Then in your source include "modeltest.h" and instantiate ModelTest with your model so the test can live for the lifetime of your model. For example:
28+
<pre>
29+
#include &lt;modeltest.h&gt;
30+
31+
QDirModel *model = new QDirModel(this);
32+
new ModelTest(model, this);
33+
</pre>
34+
</li>
35+
<li> That is it. When the test finds a problem it will assert. modeltest.cpp contains some hints on how to fix problems that the test finds. </li>
36+
</ol>
37+
38+
</body>
39+
</html>

0 commit comments

Comments
 (0)