forked from qt-creator/qt-creator
Android: Move tests from sdkmanager class to test class
Change-Id: I2e7be8f33b40d7c67e72efa88ca5528deb046ade Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -20,18 +20,13 @@
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
# include <QTest>
|
||||
# include "androidplugin.h"
|
||||
#endif // WITH_TESTS
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace {
|
||||
Q_LOGGING_CATEGORY(sdkManagerLog, "qtc.android.sdkManager", QtWarningMsg)
|
||||
const char commonArgsKey[] = "Common Arguments:";
|
||||
}
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
@@ -652,54 +647,5 @@ void AndroidSdkManagerPrivate::clearPackages()
|
||||
m_allPackages.clear();
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
void AndroidPlugin::testAndroidSdkManagerProgressParser_data()
|
||||
{
|
||||
QTest::addColumn<QString>("output");
|
||||
QTest::addColumn<int>("progress");
|
||||
QTest::addColumn<bool>("foundAssertion");
|
||||
|
||||
// Output of "sdkmanager --licenses", Android SDK Tools version 4.0
|
||||
QTest::newRow("Loading local repository")
|
||||
<< "Loading local repository... \r"
|
||||
<< -1
|
||||
<< false;
|
||||
|
||||
QTest::newRow("Fetch progress (single line)")
|
||||
<< "[============= ] 34% Fetch remote repository... \r"
|
||||
<< 34
|
||||
<< false;
|
||||
|
||||
QTest::newRow("Fetch progress (multi line)")
|
||||
<< "[============================= ] 73% Fetch remote repository... \r"
|
||||
"[============================= ] 75% Fetch remote repository... \r"
|
||||
<< 75
|
||||
<< false;
|
||||
|
||||
QTest::newRow("Some SDK package licenses not accepted")
|
||||
<< "7 of 7 SDK package licenses not accepted.\n"
|
||||
<< -1
|
||||
<< false;
|
||||
|
||||
QTest::newRow("Unaccepted licenses assertion")
|
||||
<< "\nReview licenses that have not been accepted (y/N)? "
|
||||
<< -1
|
||||
<< true;
|
||||
}
|
||||
|
||||
void AndroidPlugin::testAndroidSdkManagerProgressParser()
|
||||
{
|
||||
QFETCH(QString, output);
|
||||
QFETCH(int, progress);
|
||||
QFETCH(bool, foundAssertion);
|
||||
|
||||
bool actualFoundAssertion = false;
|
||||
const int actualProgress = parseProgress(output, actualFoundAssertion);
|
||||
|
||||
QCOMPARE(progress, actualProgress);
|
||||
QCOMPARE(foundAssertion, actualFoundAssertion);
|
||||
}
|
||||
#endif // WITH_TESTS
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
Reference in New Issue
Block a user