rbutil: Extend test for ServerInfo.
- Further extend stubs, pull in less non-stubbed implementations. - Change some test URLs to make sure the code actually uses the correct ones. Change-Id: Iac1d683748b5834e61aa4974d1b893b77f90b517
This commit is contained in:
parent
cb71e2154c
commit
687edc1866
3 changed files with 78 additions and 8 deletions
|
@ -23,6 +23,77 @@
|
|||
#include "rbsettings.h"
|
||||
#include "systeminfo.h"
|
||||
|
||||
QVariant SystemInfo::platformValue(SystemInfo::PlatformInfo info, QString platform)
|
||||
{
|
||||
switch(info) {
|
||||
case SystemInfo::Manual:
|
||||
if (platform == "iriverh120") return "iriverh100";
|
||||
if (platform == "ipodmini2g") return "ipodmini1g";
|
||||
break;
|
||||
case SystemInfo::BuildserverModel:
|
||||
return platform.split('.').at(0);
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QVariant SystemInfo::value(SystemInfo::SystemInfos info)
|
||||
{
|
||||
switch(info) {
|
||||
case SystemInfo::ManualUrl:
|
||||
//return QString("https://unittest/manual/rockbox-%MODEL%%FORMAT%");
|
||||
return QString("https://unittest/manual/%MANUALBASENAME%.%EXTENSION%");
|
||||
break;
|
||||
case SystemInfo::BleedingUrl:
|
||||
return QString("https://unittest/dev/rockbox-%MODEL%.zip");
|
||||
break;
|
||||
case SystemInfo::DailyUrl:
|
||||
return QString("https://unittest/daily/rockbox-%MODEL%-%RELVERSION%.zip");
|
||||
break;
|
||||
case SystemInfo::ReleaseUrl:
|
||||
return QString("https://unittest/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip");
|
||||
break;
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QStringList SystemInfo::platforms(SystemInfo::PlatformType type, QString variant)
|
||||
{
|
||||
// stub implementation: we have a fixed list of players, and only iaudiox5
|
||||
// has variant iaudiox5.v
|
||||
QStringList result;
|
||||
result << "iriverh100" << "iriverh120" << "iriverh300"
|
||||
<< "ipodmini2g" << "archosrecorder" << "archosfmrecorder"
|
||||
<< "gigabeatfx" << "iaudiom3" << "sansae200" << "iriverh10";
|
||||
switch (type)
|
||||
{
|
||||
case SystemInfo::PlatformBaseDisabled:
|
||||
// return base platforms only, i.e. return iaudiox5 for iaudiox5.v
|
||||
result << "iaudiox5";
|
||||
break;
|
||||
case SystemInfo::PlatformVariantDisabled:
|
||||
// return variants for the passed variant
|
||||
if (variant == "iaudiox5") {
|
||||
result.clear();
|
||||
result << "iaudiox5" << "iaudiox5.v";
|
||||
}
|
||||
else {
|
||||
result.clear();
|
||||
result << variant;
|
||||
}
|
||||
break;
|
||||
case SystemInfo::PlatformAllDisabled:
|
||||
// return all, both with and without variant.
|
||||
result << "iaudiox5" << "iaudiox5.v";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
QVariant RbSettings::value(UserSettings setting)
|
||||
{
|
||||
|
|
|
@ -69,11 +69,11 @@ const struct testvector testdata[] =
|
|||
{ "iaudiom3", ServerInfo::CurReleaseVersion, "3.11.2" },
|
||||
{ "iaudiom3", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip" },
|
||||
{ "sansae200", ServerInfo::CurReleaseVersion, "3.11.2" },
|
||||
{ "sansae200", ServerInfo::CurReleaseUrl, "http://download.rockbox.org/release/3.11.2/rockbox-sansae200-3.11.2.zip" },
|
||||
{ "sansae200", ServerInfo::CurReleaseUrl, "https://unittest/release/3.11.2/rockbox-sansae200-3.11.2.zip" },
|
||||
{ "iriverh100", ServerInfo::CurReleaseVersion, "3.11.2" },
|
||||
{ "iriverh100", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip" },
|
||||
{ "iriverh100", ServerInfo::CurStatus, "Unstable" },
|
||||
{ "iriverh100", ServerInfo::CurDevelUrl, "http://build.rockbox.org/data/rockbox-iriverh100.zip" },
|
||||
{ "iriverh100", ServerInfo::CurDevelUrl, "https://unittest/dev/rockbox-iriverh100.zip" },
|
||||
{ "iriverh300", ServerInfo::CurReleaseVersion, "" },
|
||||
{ "iriverh300", ServerInfo::CurReleaseUrl, "" },
|
||||
{ "iriverh300", ServerInfo::CurStatus, "Unusable" },
|
||||
|
@ -92,11 +92,11 @@ const struct testvector testdata[] =
|
|||
{ "iaudiox5.v", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" },
|
||||
{ "iaudiox5.v", ServerInfo::BleedingRevision, "be1be79" },
|
||||
{ "iaudiox5.v", ServerInfo::BleedingDate, "2020-11-14T10:57:23" },
|
||||
{ "iaudiox5.v", ServerInfo::CurDevelUrl, "http://build.rockbox.org/data/rockbox-iaudiox5.zip" },
|
||||
{ "iaudiox5.v", ServerInfo::ManualPdfUrl, "http://download.rockbox.org/manual/rockbox-iaudiox5.pdf" },
|
||||
{ "ipodmini2g", ServerInfo::ManualPdfUrl, "http://download.rockbox.org/manual/rockbox-ipodmini1g.pdf" },
|
||||
{ "iriverh100", ServerInfo::ManualHtmlUrl, "http://download.rockbox.org/manual/rockbox-iriverh100/rockbox-build.html" },
|
||||
{ "iriverh120", ServerInfo::ManualZipUrl, "http://download.rockbox.org/manual/rockbox-iriverh100-html.zip" },
|
||||
{ "iaudiox5.v", ServerInfo::CurDevelUrl, "https://unittest/dev/rockbox-iaudiox5.zip" },
|
||||
{ "iaudiox5.v", ServerInfo::ManualPdfUrl, "https://unittest/manual/rockbox-iaudiox5.pdf" },
|
||||
{ "ipodmini2g", ServerInfo::ManualPdfUrl, "https://unittest/manual/rockbox-ipodmini1g.pdf" },
|
||||
{ "iriverh100", ServerInfo::ManualHtmlUrl, "https://unittest/manual/rockbox-iriverh100/rockbox-build.html" },
|
||||
{ "iriverh120", ServerInfo::ManualZipUrl, "https://unittest/manual/rockbox-iriverh100-html.zip" },
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ INCLUDEPATH += . ../base stubs
|
|||
SOURCES += \
|
||||
test-serverinfo.cpp \
|
||||
stubs/stubs-serverinfo.cpp \
|
||||
../base/systeminfo.cpp \
|
||||
../base/serverinfo.cpp
|
||||
|
||||
HEADERS += \
|
||||
|
|
Loading…
Reference in a new issue