Hello community,

here is the log from the commit of package kiconthemes for openSUSE:Factory 
checked in at 2016-08-08 13:49:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kiconthemes (Old)
 and      /work/SRC/openSUSE:Factory/.kiconthemes.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kiconthemes"

Changes:
--------
--- /work/SRC/openSUSE:Factory/kiconthemes/kiconthemes.changes  2016-07-15 
12:35:18.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.kiconthemes.new/kiconthemes.changes     
2016-08-08 13:49:22.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Jul 15 15:56:47 UTC 2016 - [email protected]
+
+- Added 0001-KIconEngine-Fix-QIcon-hasThemeIcon-always-returning-.patch
+  from upstream
+
+-------------------------------------------------------------------

New:
----
  0001-KIconEngine-Fix-QIcon-hasThemeIcon-always-returning-.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kiconthemes.spec ++++++
--- /var/tmp/diff_new_pack.joQZQS/_old  2016-08-08 13:49:23.000000000 +0200
+++ /var/tmp/diff_new_pack.joQZQS/_new  2016-08-08 13:49:23.000000000 +0200
@@ -44,6 +44,8 @@
 Url:            http://www.kde.org
 Source:         
http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz
 Source1:        baselibs.conf
+# PATCH-FIX-UPSTREAM 
0001-KIconEngine-Fix-QIcon-hasThemeIcon-always-returning-.patch
+Patch0:         0001-KIconEngine-Fix-QIcon-hasThemeIcon-always-returning-.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description
@@ -73,6 +75,7 @@
 %lang_package -n %lname
 %prep
 %setup -q
+%patch0 -p1
 
 %build
   %cmake_kf5 -d build

++++++ 0001-KIconEngine-Fix-QIcon-hasThemeIcon-always-returning-.patch ++++++
>From 0abf1b7a148cf6b27caea01a329631e0f1daa983 Mon Sep 17 00:00:00 2001
From: David Rosca <[email protected]>
Date: Tue, 12 Jul 2016 09:54:04 +0200
Subject: [PATCH 1/2] KIconEngine: Fix QIcon::hasThemeIcon always returning
 true

QIcon::hasThemeIcon(name) checks if QIcon::name() == name,
so icon engine must return empty string when icon doesn't exist.
Also implement IsNullHook for Qt 5.7. Comes with autotest.

REVIEW: 128397
BUG: 365130
---
 autotests/CMakeLists.txt           |  1 +
 autotests/kiconengine_unittest.cpp | 75 ++++++++++++++++++++++++++++++++++++++
 src/kiconengine.cpp                | 15 ++++++++
 src/kiconengine.h                  |  2 +
 4 files changed, 93 insertions(+)
 create mode 100644 autotests/kiconengine_unittest.cpp

diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 
0c7de5001aebfe276bd902bf2abf63516ae32831..a81425da1b79a5200234ecc360702f6eda5696b0
 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -16,6 +16,7 @@ kiconthemes_tests(
   kiconloader_resourcethemetest
   kiconloader_benchmark
   kicontheme_unittest
+  kiconengine_unittest
 )
 
 ### Test for RCC loading
diff --git a/autotests/kiconengine_unittest.cpp 
b/autotests/kiconengine_unittest.cpp
new file mode 100644
index 
0000000000000000000000000000000000000000..c7c36aad87ed267612c027916f756d315740115d
--- /dev/null
+++ b/autotests/kiconengine_unittest.cpp
@@ -0,0 +1,75 @@
+/*
+    Copyright (C) 2016 David Rosca <[email protected]>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include <QTest>
+#include <QStandardPaths>
+
+#include <KSharedConfig>
+#include <KConfigGroup>
+#include <KIconEngine>
+#include <KIconLoader>
+
+class KIconEngine_UnitTest : public QObject
+{
+    Q_OBJECT
+
+private Q_SLOTS:
+    void initTestCase()
+    {
+        QStandardPaths::setTestModeEnabled(true);
+
+        KConfigGroup cg(KSharedConfig::openConfig(), "Icons");
+        cg.writeEntry("Theme", "oxygen");
+        cg.sync();
+
+        QDir testDataDir = 
QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
+        QDir testIconsDir = 
QDir(testDataDir.absoluteFilePath(QStringLiteral("icons")));
+
+        // we will be recursively deleting these, so a sanity check is in order
+        
QVERIFY(testIconsDir.absolutePath().contains(QStringLiteral("qttest")));
+
+        testIconsDir.removeRecursively();
+
+        // set up a minimal Oxygen icon theme, in case it is not installed
+        QVERIFY(testIconsDir.mkpath(QStringLiteral("oxygen/22x22/apps")));
+        QVERIFY(QFile::copy(QStringLiteral(":/oxygen.theme"), 
testIconsDir.filePath(QStringLiteral("oxygen/index.theme"))));
+        QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), 
testIconsDir.filePath(QStringLiteral("oxygen/22x22/apps/kde.png"))));
+    }
+
+    void testValidIconName()
+    {
+        QIcon icon(new KIconEngine(QStringLiteral("kde"), 
KIconLoader::global()));
+        QVERIFY(!icon.isNull());
+        QVERIFY(!icon.name().isEmpty());
+    }
+
+    void testInvalidIconName()
+    {
+        QIcon icon(new KIconEngine(QStringLiteral("invalid-icon-name"), 
KIconLoader::global()));
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+        QEXPECT_FAIL("", "IsNullHook needs Qt 5.7", Continue);
+#endif
+        QVERIFY(icon.isNull());
+        QVERIFY(icon.name().isEmpty());
+    }
+};
+
+QTEST_MAIN(KIconEngine_UnitTest)
+
+#include "kiconengine_unittest.moc"
diff --git a/src/kiconengine.cpp b/src/kiconengine.cpp
index 
3ccc7d1874f4bb813574d36d2bf5162062640359..c31829e82237a7432e3b7c6b1cf85cc3b2bc3ebe
 100644
--- a/src/kiconengine.cpp
+++ b/src/kiconengine.cpp
@@ -116,6 +116,9 @@ QPixmap KIconEngine::pixmap(const QSize &size, QIcon::Mode 
mode, QIcon::State st
 
 QString KIconEngine::iconName() const
 {
+    if (!mIconLoader || !mIconLoader->hasIcon(mIconName)) {
+        return QString();
+    }
     return mIconName;
 }
 
@@ -155,3 +158,15 @@ bool KIconEngine::write(QDataStream &out) const
     out << mIconName << mOverlays;
     return true;
 }
+
+void KIconEngine::virtual_hook(int id, void *data)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
+    if (id == QIconEngine::IsNullHook) {
+#else
+    if (id == 3) {
+#endif
+        *reinterpret_cast<bool*>(data) = !mIconLoader || 
!mIconLoader->hasIcon(mIconName);
+    }
+    QIconEngine::virtual_hook(id, data);
+}
diff --git a/src/kiconengine.h b/src/kiconengine.h
index 
21a63f5e52fe8afd58cf0d21ccae7bc999d581c6..79371cbcc3ff148f63c9ee10af7bcd8a55fbfd6b
 100644
--- a/src/kiconengine.h
+++ b/src/kiconengine.h
@@ -78,6 +78,8 @@ public:
     bool read(QDataStream &in) Q_DECL_OVERRIDE;
     bool write(QDataStream &out) const Q_DECL_OVERRIDE;
 
+    void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+
 private:
     //TODO KF6: move those into the d-pointer
     QString mIconName;
-- 
2.6.6


Reply via email to