summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/test
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/test')
-rw-r--r--rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp37
-rw-r--r--rbutil/rbutilqt/test/test-serverinfo.cpp39
-rw-r--r--rbutil/rbutilqt/test/test-serverinfo.pro6
3 files changed, 70 insertions, 12 deletions
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2020 Dominik Riebeling
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21// Stubs for ServerInfo unit test.
22
23#include "rbsettings.h"
24#include "systeminfo.h"
25
26
27QVariant RbSettings::value(UserSettings setting)
28{
29 switch (setting)
30 {
31 case RbSettings::CurrentPlatform:
32 return QString("ipodmini2g");
33 default:
34 return QString("");
35 }
36}
37
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
32const char* testinfo = 32const char* testinfo =
33 "[release]\n" 33 "[release]\n"
34 "archosfmrecorder=3.11.2\n" 34 "archosfmrecorder=3.11.2\n"
35 "iaudiom3=3.11.2,http://download.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip\n" 35 "iaudiom3=3.11.2,http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip\n"
36 "sansae200 = 3.11.2\n" 36 "sansae200 = 3.11.2\n"
37 "iriverh100 = 3.11.2, http://download.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip\n" 37 "iriverh100 = 3.11.2, http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip\n"
38 "iriverh300 = \n" 38 "iriverh300 = \n"
39 "[release-candidate]\n" 39 "[release-candidate]\n"
40 "gigabeatfx=f9dce96,http://download.rockbox.org/release-candidate/f9dce96/rockbox-gigabeatfx.zip\n" 40 "gigabeatfx=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip\n"
41 "archosfmrecorder=f9dce96\n" 41 "archosfmrecorder=f9dce96\n"
42 "archosrecorder = f9dce96\n" 42 "archosrecorder = f9dce96\n"
43 "iaudiox5=f9dce96,http://download.rockbox.org/release-candidate/f9dce96/rockbox-iaudiox5.zip\n"; 43 "iaudiox5=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip\n"
44 "[dailies]\n"
45 "timestamp = 20201113\n"
46 "rev = 362f7a3\n"
47 "[bleeding]\n"
48 "timestamp = 20201114T105723Z\n"
49 "rev = be1be79\n"
50 "[status]\n"
51 "archosfmrecorder=3\n"
52 "iriverh100=2\n"
53 "iriverh300=1\n"
54 "iriverh10=0\n"
55 ;
44 56
45 57
46struct testvector { 58struct testvector {
@@ -53,27 +65,36 @@ struct testvector {
53const struct testvector testdata[] = 65const struct testvector testdata[] =
54{ 66{
55 { "archosfmrecorder", ServerInfo::CurReleaseVersion, "3.11.2" }, 67 { "archosfmrecorder", ServerInfo::CurReleaseVersion, "3.11.2" },
68 { "archosfmrecorder", ServerInfo::CurStatus, "Stable" },
56 { "iaudiom3", ServerInfo::CurReleaseVersion, "3.11.2" }, 69 { "iaudiom3", ServerInfo::CurReleaseVersion, "3.11.2" },
57 { "iaudiom3", ServerInfo::CurReleaseUrl, "http://download.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip" }, 70 { "iaudiom3", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip" },
58 { "sansae200", ServerInfo::CurReleaseVersion, "3.11.2" }, 71 { "sansae200", ServerInfo::CurReleaseVersion, "3.11.2" },
59 { "sansae200", ServerInfo::CurReleaseUrl, "http://download.rockbox.org/release/3.11.2/rockbox-sansae200-3.11.2.zip" }, 72 { "sansae200", ServerInfo::CurReleaseUrl, "http://download.rockbox.org/release/3.11.2/rockbox-sansae200-3.11.2.zip" },
60 { "iriverh100", ServerInfo::CurReleaseVersion, "3.11.2" }, 73 { "iriverh100", ServerInfo::CurReleaseVersion, "3.11.2" },
61 { "iriverh100", ServerInfo::CurReleaseUrl, "http://download.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip" }, 74 { "iriverh100", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip" },
75 { "iriverh100", ServerInfo::CurStatus, "Unstable" },
76 { "iriverh100", ServerInfo::CurDevelUrl, "http://build.rockbox.org/data/rockbox-iriverh100.zip" },
62 { "iriverh300", ServerInfo::CurReleaseVersion, "" }, 77 { "iriverh300", ServerInfo::CurReleaseVersion, "" },
63 { "iriverh300", ServerInfo::CurReleaseUrl, "" }, 78 { "iriverh300", ServerInfo::CurReleaseUrl, "" },
79 { "iriverh300", ServerInfo::CurStatus, "Unusable" },
64 { "iriverh10", ServerInfo::CurReleaseVersion, "" }, 80 { "iriverh10", ServerInfo::CurReleaseVersion, "" },
65 { "iriverh10", ServerInfo::CurReleaseUrl, "" }, 81 { "iriverh10", ServerInfo::CurReleaseUrl, "" },
82 { "iriverh10", ServerInfo::CurStatus, "Stable (Retired)" },
66 { "gigabeatfx", ServerInfo::RelCandidateVersion, "f9dce96" }, 83 { "gigabeatfx", ServerInfo::RelCandidateVersion, "f9dce96" },
67 { "gigabeatfx", ServerInfo::RelCandidateUrl, "http://download.rockbox.org/release-candidate/f9dce96/rockbox-gigabeatfx.zip" }, 84 { "gigabeatfx", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip" },
68 { "archosfmrecorder", ServerInfo::RelCandidateVersion, "" }, 85 { "archosfmrecorder", ServerInfo::RelCandidateVersion, "" },
69 { "archosfmrecorder", ServerInfo::RelCandidateUrl, "" }, 86 { "archosfmrecorder", ServerInfo::RelCandidateUrl, "" },
70 { "archosrecorder", ServerInfo::RelCandidateVersion, "" }, 87 { "archosrecorder", ServerInfo::RelCandidateVersion, "" },
71 { "archosrecorder", ServerInfo::RelCandidateUrl, "" }, 88 { "archosrecorder", ServerInfo::RelCandidateUrl, "" },
72 { "iaudiox5", ServerInfo::RelCandidateVersion, "f9dce96" }, 89 { "iaudiox5", ServerInfo::RelCandidateVersion, "f9dce96" },
73 { "iaudiox5", ServerInfo::RelCandidateUrl, "http://download.rockbox.org/release-candidate/f9dce96/rockbox-iaudiox5.zip" }, 90 { "iaudiox5", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" },
74 { "iaudiox5.v", ServerInfo::RelCandidateVersion, "f9dce96" }, 91 { "iaudiox5.v", ServerInfo::RelCandidateVersion, "f9dce96" },
75 { "iaudiox5.v", ServerInfo::RelCandidateUrl, "http://download.rockbox.org/release-candidate/f9dce96/rockbox-iaudiox5.zip" }, 92 { "iaudiox5.v", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" },
93 { "iaudiox5.v", ServerInfo::BleedingRevision, "be1be79" },
94 { "iaudiox5.v", ServerInfo::BleedingDate, "2020-11-14T10:57:23" },
95 { "iaudiox5.v", ServerInfo::CurDevelUrl, "http://build.rockbox.org/data/rockbox-iaudiox5.zip" },
76 { "iaudiox5.v", ServerInfo::ManualPdfUrl, "http://download.rockbox.org/manual/rockbox-iaudiox5.pdf" }, 96 { "iaudiox5.v", ServerInfo::ManualPdfUrl, "http://download.rockbox.org/manual/rockbox-iaudiox5.pdf" },
97 { "ipodmini2g", ServerInfo::ManualPdfUrl, "http://download.rockbox.org/manual/rockbox-ipodmini1g.pdf" },
77 { "iriverh100", ServerInfo::ManualHtmlUrl, "http://download.rockbox.org/manual/rockbox-iriverh100/rockbox-build.html" }, 98 { "iriverh100", ServerInfo::ManualHtmlUrl, "http://download.rockbox.org/manual/rockbox-iriverh100/rockbox-build.html" },
78 { "iriverh120", ServerInfo::ManualZipUrl, "http://download.rockbox.org/manual/rockbox-iriverh100-html.zip" }, 99 { "iriverh120", ServerInfo::ManualZipUrl, "http://download.rockbox.org/manual/rockbox-iriverh100-html.zip" },
79}; 100};
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 @@
14# 14#
15 15
16# 16#
17include(tests.pri) 17
18QT += testlib
18 19
19TEMPLATE = app 20TEMPLATE = app
20TARGET = test-serverinfo 21TARGET = test-serverinfo
@@ -23,8 +24,7 @@ INCLUDEPATH += . ../base stubs
23# Input 24# Input
24SOURCES += \ 25SOURCES += \
25 test-serverinfo.cpp \ 26 test-serverinfo.cpp \
26 ../base/rbsettings.cpp \ 27 stubs/stubs-serverinfo.cpp \
27 ../base/rockboxinfo.cpp \
28 ../base/systeminfo.cpp \ 28 ../base/systeminfo.cpp \
29 ../base/serverinfo.cpp 29 ../base/serverinfo.cpp
30 30