From cb71e2154c082ad4b401968f04f89c35d8364da3 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 15 Nov 2020 09:51:00 +0100 Subject: rbutil: Extend test for ServerInfo. - Add tests for missing info values. - Extend stubs, pull in less non-stubbed implementations. Change-Id: I9a349f0eafe65811de37418c141fb581b6d9f59a --- rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp | 37 +++++++++++++++++++++++ rbutil/rbutilqt/test/test-serverinfo.cpp | 39 +++++++++++++++++++------ rbutil/rbutilqt/test/test-serverinfo.pro | 6 ++-- 3 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp (limited to 'rbutil/rbutilqt') diff --git a/rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp b/rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp new file mode 100644 index 0000000000..eb1ba6157b --- /dev/null +++ b/rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2020 Dominik Riebeling + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +// Stubs for ServerInfo unit test. + +#include "rbsettings.h" +#include "systeminfo.h" + + +QVariant RbSettings::value(UserSettings setting) +{ + switch (setting) + { + case RbSettings::CurrentPlatform: + return QString("ipodmini2g"); + default: + return QString(""); + } +} + diff --git a/rbutil/rbutilqt/test/test-serverinfo.cpp b/rbutil/rbutilqt/test/test-serverinfo.cpp index af04c1ff3b..925973f466 100644 --- a/rbutil/rbutilqt/test/test-serverinfo.cpp +++ b/rbutil/rbutilqt/test/test-serverinfo.cpp @@ -32,15 +32,27 @@ class TestServerInfo : public QObject const char* testinfo = "[release]\n" "archosfmrecorder=3.11.2\n" - "iaudiom3=3.11.2,http://download.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip\n" + "iaudiom3=3.11.2,http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip\n" "sansae200 = 3.11.2\n" - "iriverh100 = 3.11.2, http://download.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip\n" + "iriverh100 = 3.11.2, http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip\n" "iriverh300 = \n" "[release-candidate]\n" - "gigabeatfx=f9dce96,http://download.rockbox.org/release-candidate/f9dce96/rockbox-gigabeatfx.zip\n" + "gigabeatfx=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip\n" "archosfmrecorder=f9dce96\n" "archosrecorder = f9dce96\n" - "iaudiox5=f9dce96,http://download.rockbox.org/release-candidate/f9dce96/rockbox-iaudiox5.zip\n"; + "iaudiox5=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip\n" + "[dailies]\n" + "timestamp = 20201113\n" + "rev = 362f7a3\n" + "[bleeding]\n" + "timestamp = 20201114T105723Z\n" + "rev = be1be79\n" + "[status]\n" + "archosfmrecorder=3\n" + "iriverh100=2\n" + "iriverh300=1\n" + "iriverh10=0\n" + ; struct testvector { @@ -53,27 +65,36 @@ struct testvector { const struct testvector testdata[] = { { "archosfmrecorder", ServerInfo::CurReleaseVersion, "3.11.2" }, + { "archosfmrecorder", ServerInfo::CurStatus, "Stable" }, { "iaudiom3", ServerInfo::CurReleaseVersion, "3.11.2" }, - { "iaudiom3", ServerInfo::CurReleaseUrl, "http://download.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip" }, + { "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" }, { "iriverh100", ServerInfo::CurReleaseVersion, "3.11.2" }, - { "iriverh100", ServerInfo::CurReleaseUrl, "http://download.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip" }, + { "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" }, { "iriverh300", ServerInfo::CurReleaseVersion, "" }, { "iriverh300", ServerInfo::CurReleaseUrl, "" }, + { "iriverh300", ServerInfo::CurStatus, "Unusable" }, { "iriverh10", ServerInfo::CurReleaseVersion, "" }, { "iriverh10", ServerInfo::CurReleaseUrl, "" }, + { "iriverh10", ServerInfo::CurStatus, "Stable (Retired)" }, { "gigabeatfx", ServerInfo::RelCandidateVersion, "f9dce96" }, - { "gigabeatfx", ServerInfo::RelCandidateUrl, "http://download.rockbox.org/release-candidate/f9dce96/rockbox-gigabeatfx.zip" }, + { "gigabeatfx", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip" }, { "archosfmrecorder", ServerInfo::RelCandidateVersion, "" }, { "archosfmrecorder", ServerInfo::RelCandidateUrl, "" }, { "archosrecorder", ServerInfo::RelCandidateVersion, "" }, { "archosrecorder", ServerInfo::RelCandidateUrl, "" }, { "iaudiox5", ServerInfo::RelCandidateVersion, "f9dce96" }, - { "iaudiox5", ServerInfo::RelCandidateUrl, "http://download.rockbox.org/release-candidate/f9dce96/rockbox-iaudiox5.zip" }, + { "iaudiox5", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" }, { "iaudiox5.v", ServerInfo::RelCandidateVersion, "f9dce96" }, - { "iaudiox5.v", ServerInfo::RelCandidateUrl, "http://download.rockbox.org/release-candidate/f9dce96/rockbox-iaudiox5.zip" }, + { "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" }, }; diff --git a/rbutil/rbutilqt/test/test-serverinfo.pro b/rbutil/rbutilqt/test/test-serverinfo.pro index a01a6d64a3..627077fd58 100644 --- a/rbutil/rbutilqt/test/test-serverinfo.pro +++ b/rbutil/rbutilqt/test/test-serverinfo.pro @@ -14,7 +14,8 @@ # # -include(tests.pri) + +QT += testlib TEMPLATE = app TARGET = test-serverinfo @@ -23,8 +24,7 @@ INCLUDEPATH += . ../base stubs # Input SOURCES += \ test-serverinfo.cpp \ - ../base/rbsettings.cpp \ - ../base/rockboxinfo.cpp \ + stubs/stubs-serverinfo.cpp \ ../base/systeminfo.cpp \ ../base/serverinfo.cpp -- cgit v1.2.3