summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-05-12 10:17:24 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2021-05-19 08:25:33 +0300
commitd70a9906fced63aa1b8502dbdac58d4c244ef956 (patch)
tree0db8326ab7dd36da26e08e0825be01f631cbc3c7 /tests/auto
parent8eb9e3dd16c0057f81fa41c001722f31af32dfdf (diff)
Rename subclass static variable which shadowed baseclass method
The 'type' static variable shadowed the 'QSensors::type()' method of the baseclass. While this is easy to workaround it is better to remove such naming clash. Task-number: QTBUG-60246 Change-Id: Id0ddae978377ea4d4d0202a572c554c2541f9364 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qsensor/test_sensor.cpp2
-rw-r--r--tests/auto/qsensor/test_sensor.h4
-rw-r--r--tests/auto/qsensor/test_sensor2.cpp2
-rw-r--r--tests/auto/qsensor/test_sensor2.h4
-rw-r--r--tests/auto/qsensor/test_sensorplugin.cpp12
-rw-r--r--tests/auto/qsensor/tst_qsensor.cpp24
6 files changed, 24 insertions, 24 deletions
diff --git a/tests/auto/qsensor/test_sensor.cpp b/tests/auto/qsensor/test_sensor.cpp
index 1a1af962..e5f01fdf 100644
--- a/tests/auto/qsensor/test_sensor.cpp
+++ b/tests/auto/qsensor/test_sensor.cpp
@@ -43,6 +43,6 @@ void TestSensorReading::setTest(int test)
// =====================================================================
-const char *TestSensor::type("test sensor");
+const char *TestSensor::sensorType("test sensor");
#include "moc_test_sensor.cpp"
diff --git a/tests/auto/qsensor/test_sensor.h b/tests/auto/qsensor/test_sensor.h
index 1adb06a6..eb6244cb 100644
--- a/tests/auto/qsensor/test_sensor.h
+++ b/tests/auto/qsensor/test_sensor.h
@@ -56,14 +56,14 @@ class TestSensor : public QSensor
Q_OBJECT
public:
explicit TestSensor(QObject *parent = 0)
- : QSensor(TestSensor::type, parent)
+ : QSensor(TestSensor::sensorType, parent)
, sensorsChangedEmitted(0)
{
connect(this, SIGNAL(availableSensorsChanged()), this, SLOT(s_availableSensorsChanged()));
}
virtual ~TestSensor() {}
TestSensorReading *reading() const { return static_cast<TestSensorReading*>(QSensor::reading()); }
- static const char *type;
+ static const char *sensorType;
// used by the testSensorsChangedSignal test function
int sensorsChangedEmitted;
diff --git a/tests/auto/qsensor/test_sensor2.cpp b/tests/auto/qsensor/test_sensor2.cpp
index 22074470..bc2984c4 100644
--- a/tests/auto/qsensor/test_sensor2.cpp
+++ b/tests/auto/qsensor/test_sensor2.cpp
@@ -65,6 +65,6 @@ void TestSensor2Reading::setTest(int test)
// =====================================================================
-char const * const TestSensor2::type("test sensor 2");
+char const * const TestSensor2::sensorType("test sensor 2");
#include "moc_test_sensor2.cpp"
diff --git a/tests/auto/qsensor/test_sensor2.h b/tests/auto/qsensor/test_sensor2.h
index 69050f7c..de9dd978 100644
--- a/tests/auto/qsensor/test_sensor2.h
+++ b/tests/auto/qsensor/test_sensor2.h
@@ -87,10 +87,10 @@ class TestSensor2 : public QSensor
{
Q_OBJECT
public:
- explicit TestSensor2(QObject *parent = 0) : QSensor(TestSensor2::type, parent) {}
+ explicit TestSensor2(QObject *parent = 0) : QSensor(TestSensor2::sensorType, parent) {}
virtual ~TestSensor2() {}
TestSensor2Reading *reading() const { return static_cast<TestSensor2Reading*>(QSensor::reading()); }
- static char const * const type;
+ static char const * const sensorType;
};
#endif
diff --git a/tests/auto/qsensor/test_sensorplugin.cpp b/tests/auto/qsensor/test_sensorplugin.cpp
index a48428b3..4f72015b 100644
--- a/tests/auto/qsensor/test_sensorplugin.cpp
+++ b/tests/auto/qsensor/test_sensorplugin.cpp
@@ -55,19 +55,19 @@ public:
// This is bad code. It caused a crash due to recursively calling
// loadPlugins() in qsensormanager.cpp (because loadPlugins() did
// not set the pluginsLoaded flag soon enough).
- (void)QSensor::defaultSensorForType(TestSensor::type);
+ (void)QSensor::defaultSensorForType(TestSensor::sensorType);
- QSensorManager::registerBackend(TestSensor::type, testsensorimpl::id, this);
- QSensorManager::registerBackend(TestSensor::type, "test sensor 2", this);
- QSensorManager::registerBackend(TestSensor2::type, testsensor2impl::id, this);
+ QSensorManager::registerBackend(TestSensor::sensorType, testsensorimpl::id, this);
+ QSensorManager::registerBackend(TestSensor::sensorType, "test sensor 2", this);
+ QSensorManager::registerBackend(TestSensor2::sensorType, testsensor2impl::id, this);
}
void sensorsChanged() override
{
// Register a new type on initial load
// This is testing the "don't emit availableSensorsChanged() too many times" functionality.
- if (!QSensorManager::isBackendRegistered(TestSensor::type, "test sensor 3"))
- QSensorManager::registerBackend(TestSensor::type, "test sensor 3", this);
+ if (!QSensorManager::isBackendRegistered(TestSensor::sensorType, "test sensor 3"))
+ QSensorManager::registerBackend(TestSensor::sensorType, "test sensor 3", this);
// When a sensor of type "a random type" is registered, register another sensor.
// This is testing the "don't emit availableSensorsChanged() too many times" functionality.
diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp
index b12b1a73..d4884da9 100644
--- a/tests/auto/qsensor/tst_qsensor.cpp
+++ b/tests/auto/qsensor/tst_qsensor.cpp
@@ -123,7 +123,7 @@ private slots:
void testTypeRegistered()
{
QList<QByteArray> expected;
- expected << TestSensor::type << TestSensor2::type;
+ expected << TestSensor::sensorType << TestSensor2::sensorType;
QList<QByteArray> actual = QSensor::sensorTypes();
std::sort(actual.begin(), actual.end()); // The actual list is not in a defined order
QCOMPARE(actual, expected);
@@ -133,7 +133,7 @@ private slots:
{
QList<QByteArray> expected;
expected << "test sensor 2" << "test sensor 3" << testsensorimpl::id;
- QList<QByteArray> actual = QSensor::sensorsForType(TestSensor::type);
+ QList<QByteArray> actual = QSensor::sensorsForType(TestSensor::sensorType);
std::sort(actual.begin(), actual.end()); // The actual list is not in a defined order
QCOMPARE(actual, expected);
}
@@ -141,23 +141,23 @@ private slots:
void testSensorDefault()
{
QByteArray expected = testsensorimpl::id;
- QByteArray actual = QSensor::defaultSensorForType(TestSensor::type);
+ QByteArray actual = QSensor::defaultSensorForType(TestSensor::sensorType);
QCOMPARE(actual, expected);
}
void testBadDefaultFromConfig()
{
- QSensorManager::setDefaultBackend(QByteArray(TestSensor::type), QByteArray("bogus id"));
+ QSensorManager::setDefaultBackend(QByteArray(TestSensor::sensorType), QByteArray("bogus id"));
QByteArray expected = testsensorimpl::id;
- QByteArray actual = QSensor::defaultSensorForType(TestSensor::type);
+ QByteArray actual = QSensor::defaultSensorForType(TestSensor::sensorType);
QCOMPARE(actual, expected);
}
void testGoodDefaultFromConfig()
{
- QSensorManager::setDefaultBackend(QByteArray(TestSensor::type), QByteArray(testsensorimpl::id));
+ QSensorManager::setDefaultBackend(QByteArray(TestSensor::sensorType), QByteArray(testsensorimpl::id));
QByteArray expected = testsensorimpl::id;
- QByteArray actual = QSensor::defaultSensorForType(TestSensor::type);
+ QByteArray actual = QSensor::defaultSensorForType(TestSensor::sensorType);
QCOMPARE(actual, expected);
}
@@ -203,7 +203,7 @@ private slots:
void testBadDefaultCreation()
{
- QSensorManager::setDefaultBackend(QByteArray(TestSensor::type), QByteArray("test sensor 2"));
+ QSensorManager::setDefaultBackend(QByteArray(TestSensor::sensorType), QByteArray("test sensor 2"));
TestSensor sensor;
QTest::ignoreMessage(QtWarningMsg, "Can't create backend \"test sensor 2\"");
sensor.connectToBackend();
@@ -749,7 +749,7 @@ private slots:
// Unregister an unknown identifier
sensor.sensorsChangedEmitted = 0;
QTest::ignoreMessage(QtWarningMsg, "Identifier \"a random id\" is not registered");
- QSensorManager::unregisterBackend(TestSensor::type, "a random id");
+ QSensorManager::unregisterBackend(TestSensor::sensorType, "a random id");
QCOMPARE(sensor.sensorsChangedEmitted, 0);
// Unregister for an unknown type
@@ -760,7 +760,7 @@ private slots:
// Make sure we've cleaned up the list of available types
QList<QByteArray> expected;
- expected << TestSensor::type << TestSensor2::type;
+ expected << TestSensor::sensorType << TestSensor2::sensorType;
QList<QByteArray> actual = QSensor::sensorTypes();
std::sort(actual.begin(), actual.end()); // The actual list is not in a defined order
QCOMPARE(actual, expected);
@@ -798,11 +798,11 @@ private slots:
bool actual;
expected = true;
- actual = QSensorManager::isBackendRegistered(TestSensor::type, testsensorimpl::id);
+ actual = QSensorManager::isBackendRegistered(TestSensor::sensorType, testsensorimpl::id);
QCOMPARE(expected, actual);
expected = false;
- actual = QSensorManager::isBackendRegistered(TestSensor::type, "random");
+ actual = QSensorManager::isBackendRegistered(TestSensor::sensorType, "random");
QCOMPARE(expected, actual);
expected = false;