AutoTest: Make results tree a real tree

Provide a way to control how the results tree will be
generated for the respective test framework and use
this information to construct a real tree.
Basically this changes the layout of Qt test results,
but keeps the former layout of Google test results.

Task-number: QTCREATORBUG-17104
Change-Id: I7fca4d8e365bfebcca4cf7855cf6a882e5379143
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Stenger
2016-10-31 13:11:52 +01:00
parent 5b6e9671d7
commit cdd94cbb02
12 changed files with 269 additions and 99 deletions

View File

@@ -67,7 +67,14 @@ private:
m_typeAreaWidth = QFontMetrics(options.font).width("XXXXXXXX");
m_indentation = options.widget ? options.widget->style()->pixelMetric(
QStyle::PM_TreeViewIndentation, &options) : 0;
m_level = filterModel->mapToSource(options.index).parent() == srcModel->rootItem()->index() ? 1 : 2;
const QModelIndex &rootIndex = srcModel->rootItem()->index();
QModelIndex parentIndex = filterModel->mapToSource(options.index).parent();
m_level = 1;
while (rootIndex != parentIndex) {
++m_level;
parentIndex = parentIndex.parent();
}
int flexibleArea = lineAreaLeft() - textAreaLeft() - ITEM_SPACING;
if (m_maxFileLength > flexibleArea / 2)
m_realFileLength = flexibleArea / 2;
@@ -84,12 +91,10 @@ private:
int fontHeight() const { return m_fontHeight; }
int typeAreaLeft() const { return left() + ICON_SIZE + ITEM_SPACING; }
int typeAreaWidth() const { return m_typeAreaWidth; }
int textAreaLeft() const { return typeAreaLeft() + m_typeAreaWidth + ITEM_SPACING
+ (1 - m_level) * m_indentation; }
int textAreaLeft() const { return typeAreaLeft() + m_typeAreaWidth + ITEM_SPACING; }
int textAreaWidth() const { return fileAreaLeft() - ITEM_SPACING - textAreaLeft(); }
int fileAreaLeft() const { return lineAreaLeft() - ITEM_SPACING - m_realFileLength; }
int lineAreaLeft() const { return right() - m_maxLineLength; }
int indentation() const { return m_indentation; }
QRect typeArea() const { return QRect(typeAreaLeft(), top(),
typeAreaWidth(), m_fontHeight); }