Use LogElementType rather than int as test-element type

All callers do in fact pass members of the enum, so just making the
defualt value be LET_Undefined rather than -1 eliminates any need for
it to be an int.

Change-Id: Ic1c9ae1522363666d1208aba60d4b4df5eff6ce0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Edward Welbourne 2022-02-15 15:17:43 +01:00
parent d854534789
commit b15e01ff4e
3 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
@ -63,7 +63,7 @@ template <class ElementType>
class QTestCoreElement
{
public:
QTestCoreElement( int type = -1 );
QTestCoreElement(QTest::LogElementType type = QTest::LET_Undefined);
virtual ~QTestCoreElement();
void addAttribute(const QTest::AttributeIndex index, const char *value);
@ -81,8 +81,8 @@ class QTestCoreElement
};
template<class ElementType>
QTestCoreElement<ElementType>::QTestCoreElement(int t)
: type(QTest::LogElementType(t))
QTestCoreElement<ElementType>::QTestCoreElement(QTest::LogElementType t)
: type(t)
{
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
@ -41,7 +41,7 @@
QT_BEGIN_NAMESPACE
QTestElement::QTestElement(int type)
QTestElement::QTestElement(QTest::LogElementType type)
: QTestCoreElement<QTestElement>(type)
{
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QTestElement : public QTestCoreElement<QTestElement>
{
public:
QTestElement(int type = -1);
QTestElement(QTest::LogElementType type = QTest::LET_Undefined);
~QTestElement();
bool addChild(QTestElement *element);