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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtTest module of the Qt Toolkit. ** This file is part of the QtTest module of the Qt Toolkit.
@ -63,7 +63,7 @@ template <class ElementType>
class QTestCoreElement class QTestCoreElement
{ {
public: public:
QTestCoreElement( int type = -1 ); QTestCoreElement(QTest::LogElementType type = QTest::LET_Undefined);
virtual ~QTestCoreElement(); virtual ~QTestCoreElement();
void addAttribute(const QTest::AttributeIndex index, const char *value); void addAttribute(const QTest::AttributeIndex index, const char *value);
@ -81,8 +81,8 @@ class QTestCoreElement
}; };
template<class ElementType> template<class ElementType>
QTestCoreElement<ElementType>::QTestCoreElement(int t) QTestCoreElement<ElementType>::QTestCoreElement(QTest::LogElementType t)
: type(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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtTest module of the Qt Toolkit. ** This file is part of the QtTest module of the Qt Toolkit.
@ -41,7 +41,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QTestElement::QTestElement(int type) QTestElement::QTestElement(QTest::LogElementType type)
: QTestCoreElement<QTestElement>(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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtTest module of the Qt Toolkit. ** This file is part of the QtTest module of the Qt Toolkit.
@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QTestElement : public QTestCoreElement<QTestElement> class QTestElement : public QTestCoreElement<QTestElement>
{ {
public: public:
QTestElement(int type = -1); QTestElement(QTest::LogElementType type = QTest::LET_Undefined);
~QTestElement(); ~QTestElement();
bool addChild(QTestElement *element); bool addChild(QTestElement *element);