Files
qt-creator/tests/auto/android/tst_avdmanageroutputparser.cpp
T

92 lines
4.0 KiB
C++
Raw Normal View History

2022-08-19 15:59:36 +02:00
// Copyright (C) 2021 The Qt Company Ltd.
2022-12-21 10:12:09 +01:00
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
2021-05-06 15:19:56 +02:00
#include "avdmanageroutputparser.h"
#include <QtTest>
using namespace Android;
using namespace Android::Internal;
2024-12-18 15:24:27 +01:00
using namespace ProjectExplorer;
2021-05-06 15:19:56 +02:00
class tst_AvdManagerOutputParser : public QObject
{
Q_OBJECT
private slots:
void parse_data();
void parse();
};
void tst_AvdManagerOutputParser::parse_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<AndroidDeviceInfoList>("output");
2022-11-25 19:43:34 +01:00
QTest::addColumn<Utils::FilePaths>("errorPaths");
2021-05-06 15:19:56 +02:00
QTest::newRow("none") << "Available Android Virtual Devices:\n"
2022-11-25 19:43:34 +01:00
<< AndroidDeviceInfoList() << Utils::FilePaths();
2021-05-06 15:19:56 +02:00
QTest::newRow("one") << "Available Android Virtual Devices:\n"
" Name: Test\n"
" Device: Galaxy Nexus (Google)\n"
2022-08-08 09:21:46 +02:00
" Path: :/Test.avd\n"
2021-05-06 15:19:56 +02:00
" Target: Google APIs (Google Inc.)\n"
" Based on: Android API 30 Tag/ABI: google_apis/x86\n"
" Sdcard: 512 MB\n"
<< AndroidDeviceInfoList({{"",
"Test",
{"x86"},
-1,
IDevice::DeviceConnected,
IDevice::Emulator,
2022-08-08 09:21:46 +02:00
Utils::FilePath::fromString(":/Test.avd")}})
2022-11-25 19:43:34 +01:00
<< Utils::FilePaths();
2021-05-06 15:19:56 +02:00
QTest::newRow("two") << "Available Android Virtual Devices:\n"
" Name: Test\n"
" Device: Galaxy Nexus (Google)\n"
2022-08-08 09:21:46 +02:00
" Path: :/Test.avd\n"
2021-05-06 15:19:56 +02:00
" Target: Google APIs (Google Inc.)\n"
" Based on: Android API 30 Tag/ABI: google_apis/x86\n"
" Sdcard: 512 MB\n"
"---------\n"
" Name: TestTablet\n"
" Device: 7in WSVGA (Tablet) (Generic)\n"
2022-08-08 09:21:46 +02:00
" Path: :/TestTablet.avd\n"
2021-05-06 15:19:56 +02:00
" Target: Google APIs (Google Inc.)\n"
" Based on: Android API 30 Tag/ABI: google_apis/x86\n"
" Sdcard: 256 MB\n"
<< AndroidDeviceInfoList({{"",
"Test",
{"x86"},
-1,
IDevice::DeviceConnected,
IDevice::Emulator,
2022-08-08 09:21:46 +02:00
Utils::FilePath::fromString(":/Test.avd")},
2021-05-06 15:19:56 +02:00
{"",
"TestTablet",
{"x86"},
-1,
IDevice::DeviceConnected,
IDevice::Emulator,
2022-08-08 09:21:46 +02:00
Utils::FilePath::fromString(":/TestTablet.avd")}}
)
2022-11-25 19:43:34 +01:00
<< Utils::FilePaths();
2021-05-06 15:19:56 +02:00
}
void tst_AvdManagerOutputParser::parse()
{
QFETCH(QString, input);
QFETCH(AndroidDeviceInfoList, output);
2022-11-25 19:43:34 +01:00
QFETCH(Utils::FilePaths, errorPaths);
2021-05-06 15:19:56 +02:00
2024-05-13 12:42:30 +02:00
const auto result = parseAvdList(input);
QCOMPARE(result.avdList, output);
QCOMPARE(result.errorPaths, errorPaths);
2021-05-06 15:19:56 +02:00
}
2022-06-10 12:21:30 +02:00
QTEST_GUILESS_MAIN(tst_AvdManagerOutputParser)
2021-05-06 15:19:56 +02:00
#include "tst_avdmanageroutputparser.moc"