fix: comprehensive boot warnings and exceptions — fixable silenced, unfixable diagnosed

Build system (5 gaps hardened):
- COOKBOOK_OFFLINE defaults to true (fork-mode)
- normalize_patch handles diff -ruN format
- New 'repo validate-patches' command (25/25 relibc patches)
- 14 patched Qt/Wayland/display recipes added to protected list
- relibc archive regenerated with current patch chain

Boot fixes (fixable):
- Full ISO EFI partition: 16 MiB → 1 MiB (matches mini, BIOS hardcoded 2 MiB offset)
- D-Bus system bus: absolute /usr/bin/dbus-daemon path (was skipped)
- redbear-sessiond: absolute /usr/bin/redbear-sessiond path (was skipped)
- daemon framework: silenced spurious INIT_NOTIFY warnings for oneshot_async services (P0-daemon-silence-init-notify.patch)
- udev-shim: demoted INIT_NOTIFY warning to INFO (expected for oneshot_async)
- relibc: comprehensive named semaphores (sem_open/close/unlink) replacing upstream todo!() stubs
- greeterd: Wayland socket timeout 15s → 30s (compositor DRM wait)
- greeter-ui: built and linked (header guard unification, sem_compat stubs removed)
- mc: un-ignored in both configs, fixed glib/libiconv/pcre2 transitive deps
- greeter config: removed stale keymapd dependency from display/greeter services
- prefix toolchain: relibc headers synced, _RELIBC_STDLIB_H guard unified

Unfixable (diagnosed, upstream):
- i2c-hidd: abort on no-I2C-hardware (QEMU) — process::exit → relibc abort
- kded6/greeter-ui: page fault 0x8 — Qt library null deref
- Thread panics fd != -1 — Rust std library on Redox
- DHCP timeout / eth0 MAC — QEMU user-mode networking
- hwrngd/thermald — no hardware RNG/thermal in VM
- live preload allocation — BIOS memory fragmentation, continues on demand
This commit is contained in:
2026-05-05 20:20:37 +01:00
parent a5f97b6632
commit f31522130f
81834 changed files with 11051982 additions and 108 deletions
@@ -0,0 +1,51 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qicon_svg Test:
#####################################################################
if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
cmake_minimum_required(VERSION 3.16)
project(tst_qicon_svg LANGUAGES CXX)
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
endif()
# Collect test data
file(GLOB_RECURSE test_data_glob
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
icons/*)
list(APPEND test_data ${test_data_glob})
qt_internal_add_test(tst_qicon_svg
LOWDPI
SOURCES
tst_qicon_svg.cpp
LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Svg
TESTDATA ${test_data}
)
# Resources:
set(tst_qicon_svg_resource_files
"icons/heart.svg"
"icons/heart.svgz"
"icons/image.png"
"icons/rect.svg"
"icons/rect_size_100percent.svg"
"icons/trash.svg"
"icons/triangle.svg"
"icons/testtheme/svg/actions/heart.svg"
"icons/testtheme/16x16/actions/heart.png"
"icons/testtheme/index.theme"
)
qt_internal_add_resource(tst_qicon_svg "tst_qicon_svg"
PREFIX
"/"
FILES
${tst_qicon_svg_resource_files}
)
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="841.88976pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
<metadata>
<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work rdf:about="">
<dc:title>Heart Left-Highlight</dc:title>
<dc:description>This is a normal valentines day heart.</dc:description>
<dc:subject>
<rdf:Bag>
<rdf:li>holiday</rdf:li>
<rdf:li>valentines</rdf:li>
<rdf:li></rdf:li>
<rdf:li>valentine</rdf:li>
<rdf:li>hash(0x8a091c0)</rdf:li>
<rdf:li>hash(0x8a0916c)</rdf:li>
<rdf:li>signs_and_symbols</rdf:li>
<rdf:li>hash(0x8a091f0)</rdf:li>
<rdf:li>day</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent rdf:about="http://www.openclipart.org">
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:rights>
<dc:date></dc:date>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
<dc:language>en</dc:language>
</cc:Work>
<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
</cc:License>
</rdf:RDF>
</metadata>
<defs id="defs3"/>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/>
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
width="40px"
height="5px"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docname="test.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
inkscape:window-height="1005"
inkscape:window-width="1280"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
guidetolerance="10.0"
gridtolerance="10.0"
objecttolerance="10.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
showgrid="false"
inkscape:zoom="13.6"
inkscape:cx="20"
inkscape:cy="2.5"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:current-layer="svg2" />
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 2.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="40 : 2.5 : 1"
inkscape:persp3d-origin="20 : 1.6666667 : 1"
id="perspective9" />
</defs>
<g
id="layer1">
<rect
width="40px"
height="5px"
x="0px"
y="0px"
id="rect2393"
style="fill:#ff0000" />
</g>
<rect
style="fill:#000000"
id="rect2382"
width="2"
height="2"
x="19"
y="1.5" />
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 8">
<circle cx="8" cy="4" r="3" fill="#00ff00" />
</svg>

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

@@ -0,0 +1,17 @@
[Icon Theme]
Name=Test
Comment=Test Theme
Directories=svg/actions
[svg/actions]
Size=22
Context=Actions
Type=Scalable
MinSize=22
MaxSize=512
[16x16/actions]
Size=16
Context=Actions
Type=Fixed
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="841.88976pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
<metadata>
<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work rdf:about="">
<dc:title>Heart Left-Highlight</dc:title>
<dc:description>This is a normal valentines day heart.</dc:description>
<dc:subject>
<rdf:Bag>
<rdf:li>holiday</rdf:li>
<rdf:li>valentines</rdf:li>
<rdf:li></rdf:li>
<rdf:li>valentine</rdf:li>
<rdf:li>hash(0x8a091c0)</rdf:li>
<rdf:li>hash(0x8a0916c)</rdf:li>
<rdf:li>signs_and_symbols</rdf:li>
<rdf:li>hash(0x8a091f0)</rdf:li>
<rdf:li>day</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent rdf:about="http://www.openclipart.org">
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:rights>
<dc:date></dc:date>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
<dc:language>en</dc:language>
</cc:Work>
<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
</cc:License>
</rdf:RDF>
</metadata>
<defs id="defs3"/>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/>
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 10, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) --><svg enable-background="new 0 0 347 348" height="348" i:pageBounds="0 792 612 0" i:rulerOrigin="0 0" i:viewOrigin="131 567" overflow="visible" space="preserve" viewBox="-20 -20 387 388" width="347" xmlns="http://www.w3.org/2000/svg" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:xlink="http://www.w3.org/1999/xlink">
<metadata>
<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work rdf:about="">
<dc:title>Keep Tidy Inside</dc:title>
<dc:description></dc:description>
<dc:subject>
<rdf:Bag>
<rdf:li></rdf:li>
<rdf:li>symbol</rdf:li>
<rdf:li>bin</rdf:li>
<rdf:li>signs_and_symbols</rdf:li>
<rdf:li>clean</rdf:li>
<rdf:li>rubish</rdf:li>
<rdf:li>trash</rdf:li>
<rdf:li>inside</rdf:li>
<rdf:li>garbage</rdf:li>
<rdf:li>sign</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent rdf:about="http://www.openclipart.org">
<dc:title>Martin Owens</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Martin Owens</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Martin Owens</dc:title>
</cc:Agent>
</dc:rights>
<dc:date></dc:date>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
<dc:language>en</dc:language>
</cc:Work>
<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
</cc:License>
</rdf:RDF>
</metadata>
<g i:dimmedPercent="50" i:knockout="Off" i:layer="yes" i:rgbTrio="#4F008000FFFF" id="Layer_1">
<path d="M347,174c0,96.098-77.679,174-173.5,174C77.679,348,0,270.098,0,174 C0,77.902,77.679,0,173.5,0C269.321,0,347,77.902,347,174z" fill="#10A040" i:knockout="Off"/>
<path d="M238,53c0,13.807-11.864,25-26.5,25S185,66.807,185,53s11.864-25,26.5-25 S238,39.193,238,53z" fill="#FFFFFF" i:knockout="Off"/>
<path d="M66,175c1.055,6.355,19.333,126.417,19.333,126.417h68.333 c0,0,14.105-122.524,14.333-126.417c6.224-0.622,6.667-13-2-13c-12.164,0-89.205-0.059-98,0S61.167,174.487,66,175z" fill="#FFFFFF" i:knockout="Off"/>
<path d="M78,141c17.292-5.325,24.179-23.532,27-31c14.513,6.596,40.333,12.265,59,8 c3.683,19.419-28.043,19.31-23,37C132.577,145.705,89.404,167.292,78,141z" fill="#FFFFFF" i:knockout="Off"/>
<path d="M103,82l139-1c-0.6,3.421,33.633,57.497,29,67c-4.089,0.418-67,5-67,5 c6.109-9.379-13-43-13-43L103,82z" fill="#FFFFFF" i:knockout="Off"/>
<path d="M270,156l-66-3c0,0-23.565,143.355-24,145s1.855,2.536,3,1s51-82,51-82 s19.754,80.701,20,82s3.721,1.209,4,0S270,156,270,156z" fill="#FFFFFF" i:knockout="Off"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,12 @@
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In -->
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="39.2px" height="39.2px" viewBox="0 0 39.2 39.2" style="enable-background:new 0 0 39.2 39.2;"
xml:space="preserve">
<style type="text/css">
.st1{fill:#1B1E23;}
</style>
<defs>
</defs>
<polygon class="st1" points="15.3,11.3 29.2,19.6 15.3,27.9 "/>
</svg>

After

Width:  |  Height:  |  Size: 518 B

@@ -0,0 +1,215 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QtTest>
#include <QImageReader>
#include <QtGui>
class tst_QIcon_Svg : public QObject
{
Q_OBJECT
public:
public slots:
void initTestCase();
private slots:
void svgActualSize();
void svg();
void availableSizes();
void isNull();
void sizeInPercent();
void fromTheme_data();
void fromTheme();
private:
QString prefix;
};
void tst_QIcon_Svg::initTestCase()
{
prefix = QFINDTESTDATA("icons/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
if (!QImageReader::supportedImageFormats().contains("svg"))
QFAIL("SVG support is not available");
QCOMPARE(QImageReader::imageFormat(prefix + "triangle.svg"), QByteArray("svg"));
}
void tst_QIcon_Svg::svgActualSize()
{
QIcon icon(prefix + "rect.svg");
QCOMPARE(icon.actualSize(QSize(16, 2)), QSize(16, 2));
QCOMPARE(icon.pixmap(QSize(16, 16)).size(), QSize(16, 2));
QPixmap p(16, 16);
p.fill(Qt::cyan);
icon.addPixmap(p);
QCOMPARE(icon.actualSize(QSize(16, 16)), QSize(16, 16));
QCOMPARE(icon.pixmap(QSize(16, 16)).size(), QSize(16, 16));
QCOMPARE(icon.actualSize(QSize(16, 14)), QSize(16, 2));
QCOMPARE(icon.pixmap(QSize(16, 14)).size(), QSize(16, 2));
}
void tst_QIcon_Svg::svg()
{
QIcon icon1(prefix + "heart.svg");
QVERIFY(!icon1.pixmap(32).isNull());
QImage img1 = icon1.pixmap(32).toImage();
QVERIFY(!icon1.pixmap(32, QIcon::Disabled).isNull());
QImage img2 = icon1.pixmap(32, QIcon::Disabled).toImage();
icon1.addFile(prefix + "trash.svg", QSize(), QIcon::Disabled);
QVERIFY(!icon1.pixmap(32, QIcon::Disabled).isNull());
QImage img3 = icon1.pixmap(32, QIcon::Disabled).toImage();
QVERIFY(img3 != img2);
QVERIFY(img3 != img1);
QPixmap pm(prefix + "image.png");
icon1.addPixmap(pm, QIcon::Normal, QIcon::On);
icon1.addPixmap(pm.scaled(QSize(32, 32)), QIcon::Normal, QIcon::On);
QVERIFY(!icon1.pixmap(128, QIcon::Normal, QIcon::On).isNull());
QImage img4 = icon1.pixmap(128, QIcon::Normal, QIcon::On).toImage();
QCOMPARE_NE(img4, img3);
QCOMPARE_NE(img4, img2);
QCOMPARE_NE(img4, img1);
QVERIFY(!icon1.pixmap(32, QIcon::Normal, QIcon::On).isNull());
QImage img5 = icon1.pixmap(32, QIcon::Normal, QIcon::On).toImage();
QCOMPARE_NE(img5, img4);
QCOMPARE_NE(img5, img3);
QCOMPARE_NE(img5, img2);
QCOMPARE_NE(img5, img1);
QIcon icon2;
icon2.addFile(prefix + "heart.svg");
QVERIFY(icon2.pixmap(57).toImage() == icon1.pixmap(57).toImage());
QIcon icon3(prefix + "trash.svg");
icon3.addFile(prefix + "heart.svg");
QVERIFY(icon3.pixmap(57).toImage() == icon1.pixmap(57).toImage());
QIcon icon4(prefix + "heart.svg");
icon4.addFile(prefix + "image.png", QSize(), QIcon::Active);
QVERIFY(!icon4.pixmap(32).isNull());
QVERIFY(!icon4.pixmap(32, QIcon::Active).isNull());
QVERIFY(icon4.pixmap(32).toImage() == img1);
QIcon pmIcon(pm);
QVERIFY(icon4.pixmap(pm.size(), QIcon::Active).toImage() == pmIcon.pixmap(pm.size(), QIcon::Active).toImage());
#ifndef QT_NO_COMPRESS
QIcon icon5(prefix + "heart.svgz");
QVERIFY(!icon5.pixmap(32).isNull());
#endif
}
void tst_QIcon_Svg::availableSizes()
{
{
// checks that there are no availableSizes for scalable images.
QIcon icon(prefix + "heart.svg");
QList<QSize> availableSizes = icon.availableSizes();
qDebug() << availableSizes;
QVERIFY(availableSizes.isEmpty());
}
{
// even if an a scalable image contain added pixmaps,
// availableSizes still should be empty.
QIcon icon(prefix + "heart.svg");
icon.addFile(prefix + "image.png", QSize(32,32));
QList<QSize> availableSizes = icon.availableSizes();
QVERIFY(availableSizes.isEmpty());
}
}
void tst_QIcon_Svg::isNull()
{
{
//checks that an invalid file results in the icon being null
QIcon icon(prefix + "nonExistentFile.svg");
QVERIFY(icon.isNull());
}
{
//valid svg, we're not null
QIcon icon(prefix + "heart.svg");
QVERIFY(!icon.isNull());
// check for non null of serialized/deserialized valid icon
QByteArray buf;
QDataStream out(&buf, QIODevice::WriteOnly);
out << icon;
QIcon icon2;
QDataStream in(buf);
in >> icon2;
QVERIFY(!icon2.isNull());
}
{
//invalid svg, but a pixmap added means we're not null
QIcon icon(prefix + "nonExistentFile.svg");
icon.addFile(prefix + "image.png", QSize(32,32));
QVERIFY(!icon.isNull());
}
}
void tst_QIcon_Svg::sizeInPercent()
{
QIcon icon(prefix + "rect_size_100percent.svg");
QCOMPARE(icon.actualSize(QSize(16, 8)), QSize(16, 8));
QCOMPARE(icon.pixmap(QSize(16, 8)).size(), QSize(16, 8));
QCOMPARE(icon.actualSize(QSize(8, 8)), QSize(8, 4));
QCOMPARE(icon.pixmap(QSize(8, 8)).size(), QSize(8, 4));
}
void tst_QIcon_Svg::fromTheme_data()
{
QTest::addColumn<int>("requestedSize");
QTest::addColumn<qreal>("requestedDpr");
QTest::newRow("22x22,dpr=1") << 22 << 1.0;
QTest::newRow("22x22,dpr=2") << 22 << 2.0;
QTest::newRow("22x22,dpr=3") << 22 << 3.0;
QTest::newRow("32x32,dpr=1") << 32 << 1.0;
QTest::newRow("32x32,dpr=2") << 32 << 2.0;
QTest::newRow("32x32,dpr=3") << 32 << 3.0;
QTest::newRow("40x40,dpr=1") << 40 << 1.0;
QTest::newRow("40x40,dpr=2") << 40 << 2.0;
QTest::newRow("40x40,dpr=3") << 40 << 3.0;
}
void tst_QIcon_Svg::fromTheme()
{
QFETCH(int, requestedSize);
QFETCH(qreal, requestedDpr);
QString searchPath = QLatin1String(":/icons");
QIcon::setThemeSearchPaths(QStringList() << searchPath);
QCOMPARE(QIcon::themeSearchPaths().size(), 1);
QCOMPARE(searchPath, QIcon::themeSearchPaths()[0]);
QString themeName("testtheme");
QIcon::setThemeName(themeName);
QCOMPARE(QIcon::themeName(), themeName);
QIcon heartIcon = QIcon::fromTheme("heart");
QVERIFY(!heartIcon.isNull());
QCOMPARE(heartIcon.availableSizes().size(), 2); // 16x16, 22x22
const QPixmap pixmap = heartIcon.pixmap(QSize(requestedSize, requestedSize), requestedDpr);
const auto width = pixmap.size().width();
const auto height = pixmap.size().height();
requestedSize *= requestedDpr;
QVERIFY(width == requestedSize || height == requestedSize);
QCOMPARE(pixmap.devicePixelRatio(), requestedDpr);
}
QTEST_MAIN(tst_QIcon_Svg)
#include "tst_qicon_svg.moc"