gtk: interface GTK4, préférences, versions, traductions, licence MIT
- interface gtkmm-4 : véhicules, ajout par VIN, mises à jour, dossier, téléchargement avec reprise et arrêt, choix de la clé, confirmation, écriture avec progression, fin avec guide d'installation ; travail dans un thread, résultats renvoyés via Glib::Dispatcher - préférences : dossier de téléchargement, langue (système par défaut), recherche automatique de nouvelle version d'OpenPU - recherche de nouvelle version (releases GitHub, format tags Gitea accepté) avec ouverture de la page dans le navigateur ; openpu-cli app-update - versions : project(VERSION) + git describe régénéré à chaque build, openpu-cli --version, À propos, User-Agent, CHANGELOG, tools/release.sh (étiquette annotée, push vers tous les remotes, release GitHub) - traductions gettext : textes anglais, fr.po complet (96 chaînes), extracteur de secours sans xgettext - core : module job (téléchargement licence/fw/carte), liens des guides PDF, ordre des véhicules conservé (ordered_json) - licence MIT (LICENSE, en-têtes SPDX) ; dépôt principal sur GitHub - validé dans WSLg : parcours complet jusqu'à l'écriture d'une clé loop (FAT32 propre, fichiers téléchargés supprimés) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
1 parent
6a7a2f1ee9
commit
384aaf78c6
62 files changed
+3029
-20
No files matched your search
@@ -10,6 +10,7 @@ add_executable(openpu_tests
|
||||
test_archive.cpp
|
||||
test_storage.cpp
|
||||
test_usb.cpp
|
||||
test_app_update.cpp
|
||||
)
|
||||
find_package(LibArchive REQUIRED)
|
||||
target_link_libraries(openpu_tests PRIVATE openpu_core openpu_warnings LibArchive::LibArchive)
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include <doctest/doctest.h>
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/api_client.hpp"
|
||||
|
||||
#include <deque>
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/app_update.hpp"
|
||||
#include "openpu/models.hpp"
|
||||
#include "openpu/version.hpp"
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
using namespace openpu;
|
||||
|
||||
namespace {
|
||||
|
||||
class OneShot final : public Transport {
|
||||
public:
|
||||
HttpResponse response;
|
||||
std::string url;
|
||||
HttpResponse perform(const HttpRequest& req) override
|
||||
{
|
||||
url = req.url;
|
||||
return response;
|
||||
}
|
||||
};
|
||||
|
||||
const char* const kTags = R"([
|
||||
{"name":"v0.1.0","message":"OpenPU 0.1.0\n\nfirst"},
|
||||
{"name":"v0.10.0","message":"OpenPU 0.10.0"},
|
||||
{"name":"v0.2.0","message":"OpenPU 0.2.0"},
|
||||
{"name":"v1.0.0-rc1","message":"pre-release, ignored"},
|
||||
{"name":"experiment","message":"not a version"}
|
||||
])";
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("semantic versions")
|
||||
{
|
||||
CHECK(SemVer::parse("1.2.3").value() == SemVer{1, 2, 3});
|
||||
CHECK(SemVer::parse("v0.10.0").value() == SemVer{0, 10, 0});
|
||||
CHECK(SemVer::parse("0.2.0+3.g1a2b3c4.dirty").value() == SemVer{0, 2, 0});
|
||||
CHECK_FALSE(SemVer::parse("1.2").has_value());
|
||||
CHECK_FALSE(SemVer::parse("1.2.3-rc1").has_value());
|
||||
CHECK_FALSE(SemVer::parse("a.b.c").has_value());
|
||||
CHECK(SemVer{0, 9, 9} < SemVer{0, 10, 0}); // numeric, not lexical
|
||||
CHECK(SemVer{1, 0, 0}.toString() == "1.0.0");
|
||||
// The build's own version must be valid, or the update check could never work.
|
||||
CHECK(SemVer::parse(version()).has_value());
|
||||
CHECK(SemVer::parse(versionDescription()).has_value());
|
||||
}
|
||||
|
||||
TEST_CASE("latest release is the highest vX.Y.Z tag")
|
||||
{
|
||||
AppUpdateConfig cfg;
|
||||
cfg.pageUrl = "https://example.test/releases/tag/{tag}";
|
||||
const auto r = latestRelease(kTags, cfg);
|
||||
REQUIRE(r.has_value());
|
||||
CHECK(r->tag == "v0.10.0");
|
||||
CHECK(r->pageUrl == "https://example.test/releases/tag/v0.10.0");
|
||||
CHECK(r->notes == "OpenPU 0.10.0");
|
||||
CHECK_FALSE(latestRelease("[]", cfg).has_value());
|
||||
CHECK_THROWS_AS(latestRelease("{}", cfg), ParseError);
|
||||
}
|
||||
|
||||
TEST_CASE("GitHub releases: html_url and body, drafts and pre-releases skipped")
|
||||
{
|
||||
const char* releases = R"([
|
||||
{"tag_name":"v0.3.0","draft":true,"prerelease":false,"html_url":"https://gh/d","body":"draft"},
|
||||
{"tag_name":"v0.2.1","draft":false,"prerelease":true,"html_url":"https://gh/p","body":"pre"},
|
||||
{"tag_name":"v0.2.0","draft":false,"prerelease":false,"html_url":"https://gh/r/v0.2.0","body":"notes"},
|
||||
{"tag_name":"v0.1.0","draft":false,"prerelease":false,"html_url":"https://gh/r/v0.1.0","body":"old"}
|
||||
])";
|
||||
const auto r = latestRelease(releases, AppUpdateConfig{});
|
||||
REQUIRE(r.has_value());
|
||||
CHECK(r->tag == "v0.2.0");
|
||||
CHECK(r->pageUrl == "https://gh/r/v0.2.0");
|
||||
CHECK(r->notes == "notes");
|
||||
}
|
||||
|
||||
TEST_CASE("newer release detection")
|
||||
{
|
||||
OneShot t;
|
||||
t.response.status = 200;
|
||||
t.response.body = kTags;
|
||||
AppUpdateConfig cfg;
|
||||
cfg.releasesUrl = "https://example.test/tags";
|
||||
const auto newer = checkForNewerRelease(t, cfg, "0.2.0");
|
||||
REQUIRE(newer.has_value());
|
||||
CHECK(newer->version == SemVer{0, 10, 0});
|
||||
CHECK(t.url == "https://example.test/tags");
|
||||
CHECK_FALSE(checkForNewerRelease(t, cfg, "0.10.0").has_value());
|
||||
CHECK_FALSE(checkForNewerRelease(t, cfg, "1.0.0").has_value());
|
||||
t.response.status = 404;
|
||||
CHECK_THROWS(checkForNewerRelease(t, cfg, "0.1.0"));
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/archive.hpp"
|
||||
|
||||
#include "test_util.hpp"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/download.hpp"
|
||||
|
||||
#include "test_util.hpp"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/http.hpp"
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/models.hpp"
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/storage.hpp"
|
||||
|
||||
#include "test_util.hpp"
|
||||
@@ -91,6 +92,11 @@ TEST_CASE("settings round trip")
|
||||
CHECK(r.pending->firmware);
|
||||
CHECK_FALSE(r.pending->map);
|
||||
CHECK(r.pending->licenseFile == "license_X.key");
|
||||
CHECK(r.checkAppUpdates); // default
|
||||
|
||||
s.checkAppUpdates = false;
|
||||
s.save(file);
|
||||
CHECK_FALSE(Settings::load(file).checkAppUpdates);
|
||||
}
|
||||
|
||||
TEST_CASE("XDG paths")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/archive.hpp"
|
||||
#include "openpu/usb.hpp"
|
||||
|
||||
@@ -150,3 +151,31 @@ TEST_CASE("drive description")
|
||||
d.size = 32000000000ULL;
|
||||
CHECK(d.description() == "SanDisk Ultra (/dev/sdb, 32.0 GB)");
|
||||
}
|
||||
|
||||
#include "openpu/job.hpp"
|
||||
|
||||
TEST_CASE("installation guide links")
|
||||
{
|
||||
CHECK(guideUrl("path_guide_rcc", "fr").find("map-software-rcc-fr") != std::string::npos);
|
||||
CHECK(guideUrl("path_guide_wave_4", "fr").find("map-software-nac-fr") != std::string::npos);
|
||||
CHECK(guideUrl("path_guide_wave_default", "de").find("map-software-nac-en") != std::string::npos);
|
||||
CHECK(guideUrl("path_guide_aio", "en").find("map-software-iao") != std::string::npos);
|
||||
CHECK(guideUrl("path_guide_crony_2", "fr") == "https://www.stellantis.com/");
|
||||
CHECK(guideUrl("", "fr").empty());
|
||||
}
|
||||
|
||||
TEST_CASE("downloaded files give the write plan in the official order")
|
||||
{
|
||||
DownloadedFiles f;
|
||||
f.license = fs::path("/dl/license_X.key");
|
||||
f.firmware = fs::path("/dl/fw.tar");
|
||||
f.map = fs::path("/dl/map.tar");
|
||||
auto plan = f.writePlan();
|
||||
REQUIRE(plan.license.has_value());
|
||||
CHECK(plan.archives == std::vector<fs::path>{"/dl/fw.tar", "/dl/map.tar"});
|
||||
|
||||
f.firmware.reset(); // map only: the license is not copied
|
||||
plan = f.writePlan();
|
||||
CHECK_FALSE(plan.license.has_value());
|
||||
CHECK(plan.archives == std::vector<fs::path>{"/dl/map.tar"});
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "openpu/vin.hpp"
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
Reference in new issue
Block a user