Improve settings.
[dorian] / model / modeltest / README
1 ModelTest provides a way to check for common errors in implementations of  <a href="QAbstractItemModel">http://doc.trolltech.com/4/qabstractitemmodel.html</a>.
2
3
4 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:
5 <ul>
6 <li>Verifing X number of rows have been inserted in the correct place after the signal rowsAboutToBeInserted() says X rows will be inserted.</li>
7 <li>The parent of the first index of the first row is a QModelIndex()</li>
8 <li>Calling index() twice in a row with the same values will return the same QModelIndex</li>
9 <li>If rowCount() says there are X number of rows, model test will verify that is true.
10 <li>Many possible off by one bugs</li>
11 <li>hasChildren() returns true if rowCount() is greater then zero.</li>
12 <li>and many more...</li>
13 </ul>
14
15 ---
16
17 To Use the model test do the following:
18
19 1) Include the pri file at the end of your project pro file using the include() command like so:
20
21 include(../path/to/dir/modeltest.pri)
22
23 2) 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:  
24
25 #include <modeltest.h>
26
27 QDirModel *model = new QDirModel(this);
28 new ModelTest(model, this);
29
30 3) 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.