Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 8: [PATCH 08/17] chore(roots): integrate v31 identity and maintenance tooling

ci/test/test_windows_gui_workflows.py

Before: /dev/null · After: ci/test/test_windows_gui_workflows.py

File metadata
new file mode 100755
index 0000000000000000000000000000000000000000..ae9b9eeb67426d90b7370ab6151d3e548966278d

Download original patch · Release notes

Diff rows 1–75 of 75. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

ci/test/test_windows_gui_workflows.py ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) 2026-present The Bitcoin Roots developers
3
+ # Distributed under the MIT software license, see the accompanying
4
+ # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
+
6
+ from pathlib import Path
7
+ import re
8
+ import unittest
9
+ import xml.etree.ElementTree as ET
10
+
11
+
12
+ ROOT = Path(__file__).resolve().parents[2]
13
+ CI_WORKFLOW = ROOT / ".github/workflows/ci.yml"
14
+ RELEASE_WORKFLOW = ROOT / ".github/workflows/release.yml"
15
+ ROOTS_LOGO = ROOT / "src/qt/res/src/bitcoinroots-logo.svg"
16
+ WINDOWS_RESOURCES = ROOT / "src/qt/res/bitcoin-qt-res.rc"
17
+
18
+
19
+ def job(workflow, name):
20
+ text = workflow.read_text(encoding="utf-8")
21
+ match = re.search(rf"(?ms)^ {re.escape(name)}:\n(.*?)(?=^ [a-z0-9_-]+:\n|\Z)", text)
22
+ if match is None:
23
+ raise AssertionError(f"Job {name!r} does not exist in {workflow}")
24
+ return match.group(1)
25
+
26
+
27
+ class WindowsGuiWorkflowTest(unittest.TestCase):
28
+ def test_roots_logo_preserves_icon_rendering_dimensions(self):
29
+ logo = ET.parse(ROOTS_LOGO).getroot()
30
+ self.assertEqual(logo.attrib["width"], "1in")
31
+ self.assertEqual(logo.attrib["height"], "1in")
32
+
33
+ _, _, viewbox_width, viewbox_height = logo.attrib["viewBox"].split()
34
+ self.assertEqual(viewbox_width, viewbox_height)
35
+
36
+ def test_windows_resources_use_source_absolute_icon_paths(self):
37
+ resources = WINDOWS_RESOURCES.read_text(encoding="utf-8")
38
+ icon_lines = [line for line in resources.splitlines() if " ICON " in line]
39
+ self.assertEqual(len(icon_lines), 4)
40
+ for line in icon_lines:
41
+ self.assertIn('@CMAKE_CURRENT_SOURCE_DIR@/res/icons/', line)
42
+
43
+ def assert_static_gui_assets(self, windows_job):
44
+ self.assertNotIn("setup-windows-gui-tools", windows_job)
45
+ self.assertNotIn("-DRSVG_CONVERT=", windows_job)
46
+ self.assertNotIn("-DIMAGEMAGICK_CONVERT=", windows_job)
47
+ for filename in ["bitcoin.ico", "bitcoin.icns", "bitcoin.png", "bitcoinroots-splash.png"]:
48
+ self.assertTrue((ROOT / "src/qt/res/icons" / filename).is_file(), filename)
49
+ gui_cmake = (ROOT / "src/qt/CMakeLists.txt").read_text(encoding="utf-8")
50
+ self.assertNotIn("find_program(RSVG_CONVERT", gui_cmake)
51
+
52
+ def test_nightly_smoke_builds_and_tests_windows_gui(self):
53
+ windows_smoke = job(ROOT / ".github/workflows/nightly.yml", "windows-smoke")
54
+ self.assert_static_gui_assets(windows_smoke)
55
+ self.assertIn("-DBUILD_GUI=ON", windows_smoke)
56
+ self.assertNotIn("-DBUILD_GUI=OFF", windows_smoke)
57
+ self.assertIn("-DBUILD_TESTS=ON", windows_smoke)
58
+ self.assertIn("ctest --test-dir build -C Release --output-on-failure", windows_smoke)
59
+
60
+ def test_release_builds_and_packages_windows_gui(self):
61
+ windows_release = job(RELEASE_WORKFLOW, "windows-release")
62
+ self.assert_static_gui_assets(windows_release)
63
+ self.assertIn("-DBUILD_GUI=ON", windows_release)
64
+ self.assertNotIn("-DBUILD_GUI=OFF", windows_release)
65
+ self.assertIn("-DCMAKE_COMPILE_WARNING_AS_ERROR=ON", windows_release)
66
+ self.assertIn("python ci/release/archive.py root-name", windows_release)
67
+ self.assertIn("Compress-Archive -Path $installDir", windows_release)
68
+ self.assertNotIn('Compress-Archive -Path (Join-Path $installDir "*")', windows_release)
69
+ self.assertIn("python ci/release/archive.py validate", windows_release)
70
+ self.assertIn('Join-Path $installDir "bin\\bitcoin-qt.exe"', windows_release)
71
+ self.assertIn("Test-Path -PathType Leaf", windows_release)
72
+
73
+
74
+ if __name__ == "__main__":
75
+ unittest.main()