I'm using the ModelTest class from Trolltech Labs to great results. However, one failure it threw I do not think is correct. Specifically, the check for valid alignment flags from QAbstractItemModel::data() is incorrect, as it is only checking horizontal values. Instead, I think it should just check if the returned value contains bits outside of the mask created by Qt::AlignHorizontal_Mask & Qt::AlignVertical_Mask, like so:
Index: modeltest.cpp
===================================================================
--- modeltest.cpp (revision 1436)
+++ modeltest.cpp (working copy)
@@ -421,17 +421,8 @@
QVariant textAlignmentVariant = model->data(model->index(0, 0), Qt::TextAlignmentRole);
if (textAlignmentVariant.isValid()) {
int alignment = textAlignmentVariant.toInt();
- Q_ASSERT(alignment == Qt::AlignLeft ||
- alignment == Qt::AlignRight ||
- alignment == Qt::AlignHCenter ||
- alignment == Qt::AlignJustify ||
- alignment == Qt::AlignTop ||
- alignment == Qt::AlignBottom ||
- alignment == Qt::AlignVCenter ||
- alignment == Qt::AlignCenter ||
- alignment == Qt::AlignAbsolute ||
- alignment == Qt::AlignLeading ||
- alignment == Qt::AlignTrailing);
+ Q_ASSERT( alignment == ( alignment & ( Qt::AlignHorizontal_Mask |
+ Qt::AlignVertical_Mask ) ) );
}
// General Purpose roles that should return a QColor
Brad