forked from qt-creator/qt-creator
Android: Have test class definitions closer to tested code
Change-Id: I92fbc2285a6d3f6d6b5e891f6727d5aa9778efa8 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -23,7 +23,7 @@ add_qtc_plugin(Android
|
|||||||
androidmanifesteditoriconwidget.cpp androidmanifesteditoriconwidget.h
|
androidmanifesteditoriconwidget.cpp androidmanifesteditoriconwidget.h
|
||||||
androidmanifesteditoriconcontainerwidget.cpp androidmanifesteditoriconcontainerwidget.h
|
androidmanifesteditoriconcontainerwidget.cpp androidmanifesteditoriconcontainerwidget.h
|
||||||
androidpackageinstallationstep.cpp androidpackageinstallationstep.h
|
androidpackageinstallationstep.cpp androidpackageinstallationstep.h
|
||||||
androidplugin.cpp androidplugin.h
|
androidplugin.cpp
|
||||||
androidpotentialkit.cpp androidpotentialkit.h
|
androidpotentialkit.cpp androidpotentialkit.h
|
||||||
androidqmlpreviewworker.cpp androidqmlpreviewworker.h
|
androidqmlpreviewworker.cpp androidqmlpreviewworker.h
|
||||||
androidqmltoolingsupport.cpp androidqmltoolingsupport.h
|
androidqmltoolingsupport.cpp androidqmltoolingsupport.h
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ QtcPlugin {
|
|||||||
"androidpackageinstallationstep.cpp",
|
"androidpackageinstallationstep.cpp",
|
||||||
"androidpackageinstallationstep.h",
|
"androidpackageinstallationstep.h",
|
||||||
"androidplugin.cpp",
|
"androidplugin.cpp",
|
||||||
"androidplugin.h",
|
|
||||||
"androidpotentialkit.cpp",
|
"androidpotentialkit.cpp",
|
||||||
"androidpotentialkit.h",
|
"androidpotentialkit.h",
|
||||||
"androidqmlpreviewworker.h",
|
"androidqmlpreviewworker.h",
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
# include <QTest>
|
# include <QTest>
|
||||||
# include "androidplugin.h"
|
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|
||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
@@ -1563,7 +1562,17 @@ void AndroidConfigurations::updateAndroidDevice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
void AndroidTests::testAndroidConfigAvailableNdkPlatforms_data()
|
|
||||||
|
class AndroidConfigurationsTest final : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void testAndroidConfigAvailableNdkPlatforms_data();
|
||||||
|
void testAndroidConfigAvailableNdkPlatforms();
|
||||||
|
};
|
||||||
|
|
||||||
|
void AndroidConfigurationsTest::testAndroidConfigAvailableNdkPlatforms_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<FilePath>("ndkPath");
|
QTest::addColumn<FilePath>("ndkPath");
|
||||||
QTest::addColumn<Abis>("abis");
|
QTest::addColumn<Abis>("abis");
|
||||||
@@ -1608,7 +1617,7 @@ void AndroidTests::testAndroidConfigAvailableNdkPlatforms_data()
|
|||||||
<< abis64Bit;
|
<< abis64Bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidTests::testAndroidConfigAvailableNdkPlatforms()
|
void AndroidConfigurationsTest::testAndroidConfigAvailableNdkPlatforms()
|
||||||
{
|
{
|
||||||
QFETCH(FilePath, ndkPath);
|
QFETCH(FilePath, ndkPath);
|
||||||
QFETCH(Abis, abis);
|
QFETCH(Abis, abis);
|
||||||
@@ -1619,6 +1628,11 @@ void AndroidTests::testAndroidConfigAvailableNdkPlatforms()
|
|||||||
QCOMPARE(foundPlatforms, expectedPlatforms);
|
QCOMPARE(foundPlatforms, expectedPlatforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject *createAndroidConfigurationsTest()
|
||||||
|
{
|
||||||
|
return new AndroidConfigurationsTest;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|
||||||
void setupAndroidConfigurations()
|
void setupAndroidConfigurations()
|
||||||
@@ -1627,3 +1641,5 @@ void setupAndroidConfigurations()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Android
|
} // namespace Android
|
||||||
|
|
||||||
|
#include "androidconfigurations.moc"
|
||||||
|
|||||||
@@ -208,6 +208,10 @@ private:
|
|||||||
std::unique_ptr<Internal::AndroidSdkManager> m_sdkManager;
|
std::unique_ptr<Internal::AndroidSdkManager> m_sdkManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
QObject *createAndroidConfigurationsTest();
|
||||||
|
#endif
|
||||||
|
|
||||||
void setupAndroidConfigurations();
|
void setupAndroidConfigurations();
|
||||||
|
|
||||||
} // namespace Android
|
} // namespace Android
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
// Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "androidplugin.h"
|
|
||||||
|
|
||||||
#include "androidconfigurations.h"
|
#include "androidconfigurations.h"
|
||||||
#include "androidbuildapkstep.h"
|
#include "androidbuildapkstep.h"
|
||||||
#include "androidconstants.h"
|
#include "androidconstants.h"
|
||||||
@@ -123,9 +121,10 @@ class AndroidPlugin final : public ExtensionSystem::IPlugin
|
|||||||
[] { return new JLSSettings; }});
|
[] { return new JLSSettings; }});
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
addTest<AndroidSdkManagerTest>();
|
addTestCreator(createAndroidSdkManagerTest);
|
||||||
addTest<SdkManagerOutputParserTest>();
|
addTestCreator(createAndroidSdkManagerOutputParserTest);
|
||||||
addTest<AndroidTests>();
|
addTestCreator(createAndroidQtVersionTest);
|
||||||
|
addTestCreator(createAndroidConfigurationsTest);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
// Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace Android::Internal {
|
|
||||||
|
|
||||||
class AndroidTests final : public QObject
|
|
||||||
{
|
|
||||||
#ifdef WITH_TESTS
|
|
||||||
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void testAndroidConfigAvailableNdkPlatforms_data();
|
|
||||||
void testAndroidConfigAvailableNdkPlatforms();
|
|
||||||
void testAndroidQtVersionParseBuiltWith_data();
|
|
||||||
void testAndroidQtVersionParseBuiltWith();
|
|
||||||
#endif // WITH_TESTS
|
|
||||||
};
|
|
||||||
|
|
||||||
} // Android::Internal
|
|
||||||
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
# include <QTest>
|
# include <QTest>
|
||||||
# include "androidplugin.h"
|
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -286,7 +285,17 @@ void setupAndroidQtVersion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
void AndroidTests::testAndroidQtVersionParseBuiltWith_data()
|
|
||||||
|
class AndroidQtVersionTest final : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void testAndroidQtVersionParseBuiltWith_data();
|
||||||
|
void testAndroidQtVersionParseBuiltWith();
|
||||||
|
};
|
||||||
|
|
||||||
|
void AndroidQtVersionTest::testAndroidQtVersionParseBuiltWith_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("modulesCoreJson");
|
QTest::addColumn<QString>("modulesCoreJson");
|
||||||
QTest::addColumn<bool>("hasInfo");
|
QTest::addColumn<bool>("hasInfo");
|
||||||
@@ -332,7 +341,7 @@ void AndroidTests::testAndroidQtVersionParseBuiltWith_data()
|
|||||||
<< 31;
|
<< 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidTests::testAndroidQtVersionParseBuiltWith()
|
void AndroidQtVersionTest::testAndroidQtVersionParseBuiltWith()
|
||||||
{
|
{
|
||||||
QFETCH(QString, modulesCoreJson);
|
QFETCH(QString, modulesCoreJson);
|
||||||
QFETCH(bool, hasInfo);
|
QFETCH(bool, hasInfo);
|
||||||
@@ -346,6 +355,14 @@ void AndroidTests::testAndroidQtVersionParseBuiltWith()
|
|||||||
QCOMPARE(bw.apiVersion, apiVersion);
|
QCOMPARE(bw.apiVersion, apiVersion);
|
||||||
QCOMPARE(bw.ndkVersion, ndkVersion);
|
QCOMPARE(bw.ndkVersion, ndkVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject *createAndroidQtVersionTest()
|
||||||
|
{
|
||||||
|
return new AndroidQtVersionTest;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|
||||||
} // Android::Internal
|
} // Android::Internal
|
||||||
|
|
||||||
|
#include "androidqtversion.moc"
|
||||||
|
|||||||
@@ -51,4 +51,8 @@ private:
|
|||||||
|
|
||||||
void setupAndroidQtVersion();
|
void setupAndroidQtVersion();
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
QObject *createAndroidQtVersionTest();
|
||||||
|
#endif
|
||||||
|
|
||||||
} // Android::Internal
|
} // Android::Internal
|
||||||
|
|||||||
@@ -8,11 +8,14 @@
|
|||||||
|
|
||||||
namespace Android::Internal {
|
namespace Android::Internal {
|
||||||
|
|
||||||
AndroidSdkManagerTest::AndroidSdkManagerTest(QObject *parent)
|
class AndroidSdkManagerTest final : public QObject
|
||||||
: QObject(parent)
|
{
|
||||||
{}
|
Q_OBJECT
|
||||||
|
|
||||||
AndroidSdkManagerTest::~AndroidSdkManagerTest() = default;
|
private slots:
|
||||||
|
void testAndroidSdkManagerProgressParser_data();
|
||||||
|
void testAndroidSdkManagerProgressParser();
|
||||||
|
};
|
||||||
|
|
||||||
void AndroidSdkManagerTest::testAndroidSdkManagerProgressParser_data()
|
void AndroidSdkManagerTest::testAndroidSdkManagerProgressParser_data()
|
||||||
{
|
{
|
||||||
@@ -61,5 +64,11 @@ void AndroidSdkManagerTest::testAndroidSdkManagerProgressParser()
|
|||||||
QCOMPARE(foundAssertion, actualFoundAssertion);
|
QCOMPARE(foundAssertion, actualFoundAssertion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject *createAndroidSdkManagerTest()
|
||||||
|
{
|
||||||
|
return new AndroidSdkManagerTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Android::Internal
|
||||||
|
|
||||||
|
#include "androidsdkmanager_test.moc"
|
||||||
|
|||||||
@@ -5,23 +5,8 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
namespace Android::Internal {
|
||||||
class QString;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Android {
|
QObject *createAndroidSdkManagerTest();
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class AndroidSdkManagerTest : public QObject
|
} // Android::Internal
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
AndroidSdkManagerTest(QObject *parent = nullptr);
|
|
||||||
~AndroidSdkManagerTest();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void testAndroidSdkManagerProgressParser_data();
|
|
||||||
void testAndroidSdkManagerProgressParser();
|
|
||||||
};
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Android
|
|
||||||
|
|||||||
@@ -10,18 +10,65 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include <QVersionNumber>
|
#include <QVersionNumber>
|
||||||
#include <QtGlobal>
|
|
||||||
#include <qtestcase.h>
|
|
||||||
#include <QVersionNumber>
|
#include <QVersionNumber>
|
||||||
|
|
||||||
namespace Android::Internal {
|
namespace Android::Internal {
|
||||||
|
|
||||||
SdkManagerOutputParserTest::SdkManagerOutputParserTest(QObject *parent)
|
class SdkManagerOutputParserTest : public QObject
|
||||||
: QObject(parent)
|
{
|
||||||
, m_parser(std::make_unique<SdkManagerOutputParser>(m_packages))
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
SdkManagerOutputParserTest()
|
||||||
|
: m_parser(std::make_unique<SdkManagerOutputParser>(m_packages))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SdkManagerOutputParserTest::~SdkManagerOutputParserTest() = default;
|
private:
|
||||||
|
AndroidSdkPackageList m_packages;
|
||||||
|
std::unique_ptr<SdkManagerOutputParser> m_parser;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void testParsePackageListing_data();
|
||||||
|
void testParsePackageListing();
|
||||||
|
|
||||||
|
void testParseMarkers_data();
|
||||||
|
void testParseMarkers();
|
||||||
|
|
||||||
|
void testParseBuildToolsPackage_data();
|
||||||
|
void testParseBuildToolsPackage();
|
||||||
|
void testParseBuildToolsPackageEmpty();
|
||||||
|
|
||||||
|
void testParseSdkToolsPackage_data();
|
||||||
|
void testParseSdkToolsPackage();
|
||||||
|
void testParseSdkToolsPackageEmpty();
|
||||||
|
|
||||||
|
void testParsePlatformToolsPackage_data();
|
||||||
|
void testParsePlatformToolsPackage();
|
||||||
|
void testParsePlatformToolsPackageEmpty();
|
||||||
|
|
||||||
|
void testParseEmulatorToolsPackage_data();
|
||||||
|
void testParseEmulatorToolsPackage();
|
||||||
|
void testParseEmulatorToolsPackageEmpty();
|
||||||
|
|
||||||
|
void testParseNdkPackage_data();
|
||||||
|
void testParseNdkPackage();
|
||||||
|
void testParseNdkPackageEmpty();
|
||||||
|
|
||||||
|
void testParseExtraToolsPackage_data();
|
||||||
|
void testParseExtraToolsPackage();
|
||||||
|
void testParseExtraToolsPackageEmpty();
|
||||||
|
|
||||||
|
void testParseGenericToolsPackage_data();
|
||||||
|
void testParseGenericToolsPackage();
|
||||||
|
void testParseGenericToolsPackageEmpty();
|
||||||
|
|
||||||
|
void testParsePlatformPackage_data();
|
||||||
|
void testParsePlatformPackage();
|
||||||
|
void testParsePlatformPackageEmpty();
|
||||||
|
|
||||||
|
void testParseSystemImagePackage_data();
|
||||||
|
void testParseSystemImagePackage();
|
||||||
|
void testParseSystemImagePackageEmpty();
|
||||||
|
};
|
||||||
|
|
||||||
void SdkManagerOutputParserTest::testParseMarkers_data()
|
void SdkManagerOutputParserTest::testParseMarkers_data()
|
||||||
{
|
{
|
||||||
@@ -789,5 +836,11 @@ cmdline-tools;latest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject *createAndroidSdkManagerOutputParserTest()
|
||||||
|
{
|
||||||
|
return new SdkManagerOutputParserTest;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Android::Internal
|
} // namespace Android::Internal
|
||||||
|
|
||||||
|
#include "sdkmanageroutputparser_test.moc"
|
||||||
|
|||||||
@@ -5,70 +5,8 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "androidsdkpackage.h"
|
namespace Android::Internal {
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QObject *createAndroidSdkManagerOutputParserTest();
|
||||||
class QString;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Android {
|
} // Android::Internal
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class SdkManagerOutputParser;
|
|
||||||
|
|
||||||
class SdkManagerOutputParserTest : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
SdkManagerOutputParserTest(QObject *parent = nullptr);
|
|
||||||
~SdkManagerOutputParserTest();
|
|
||||||
|
|
||||||
private:
|
|
||||||
AndroidSdkPackageList m_packages;
|
|
||||||
std::unique_ptr<SdkManagerOutputParser> m_parser;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void testParsePackageListing_data();
|
|
||||||
void testParsePackageListing();
|
|
||||||
|
|
||||||
void testParseMarkers_data();
|
|
||||||
void testParseMarkers();
|
|
||||||
|
|
||||||
void testParseBuildToolsPackage_data();
|
|
||||||
void testParseBuildToolsPackage();
|
|
||||||
void testParseBuildToolsPackageEmpty();
|
|
||||||
|
|
||||||
void testParseSdkToolsPackage_data();
|
|
||||||
void testParseSdkToolsPackage();
|
|
||||||
void testParseSdkToolsPackageEmpty();
|
|
||||||
|
|
||||||
void testParsePlatformToolsPackage_data();
|
|
||||||
void testParsePlatformToolsPackage();
|
|
||||||
void testParsePlatformToolsPackageEmpty();
|
|
||||||
|
|
||||||
void testParseEmulatorToolsPackage_data();
|
|
||||||
void testParseEmulatorToolsPackage();
|
|
||||||
void testParseEmulatorToolsPackageEmpty();
|
|
||||||
|
|
||||||
void testParseNdkPackage_data();
|
|
||||||
void testParseNdkPackage();
|
|
||||||
void testParseNdkPackageEmpty();
|
|
||||||
|
|
||||||
void testParseExtraToolsPackage_data();
|
|
||||||
void testParseExtraToolsPackage();
|
|
||||||
void testParseExtraToolsPackageEmpty();
|
|
||||||
|
|
||||||
void testParseGenericToolsPackage_data();
|
|
||||||
void testParseGenericToolsPackage();
|
|
||||||
void testParseGenericToolsPackageEmpty();
|
|
||||||
|
|
||||||
void testParsePlatformPackage_data();
|
|
||||||
void testParsePlatformPackage();
|
|
||||||
void testParsePlatformPackageEmpty();
|
|
||||||
|
|
||||||
void testParseSystemImagePackage_data();
|
|
||||||
void testParseSystemImagePackage();
|
|
||||||
void testParseSystemImagePackageEmpty();
|
|
||||||
};
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Android
|
|
||||||
|
|||||||
Reference in New Issue
Block a user