[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui
From:       David Faure <faure () kde ! org>
Date:       2010-12-09 23:46:15
Message-ID: 20101209234615.23050AC8A6 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1205002 by dfaure:

Sanitize the kErrors from KConfigGroupGui.
Add QTest::ignoreMessage for the expected qt warning.
KDE warnings cannot be caught this way, it seems.


 M  +7 -8      config/kconfiggroupgui.cpp  
 M  +4 -0      tests/kconfigguitest.cpp  


--- trunk/KDE/kdelibs/kdeui/config/kconfiggroupgui.cpp #1205001:1205002
@@ -61,7 +61,7 @@
             QColor col;
             col.setNamedColor(QString::fromUtf8(data.constData(), data.length()));
             if (!col.isValid())
-                kError() << errString << endl;
+                kError() << qPrintable(errString);
             output = col;
             return true;
         } else {
@@ -69,7 +69,7 @@
             const int count = list.count();
 
             if (count != 3 && count != 4) {
-                kError() << errString << formatError.arg("3' or '4").arg(count) << endl;
+                kError() << qPrintable(errString) << qPrintable(formatError.arg("3' or '4").arg(count));
                 return true;    // return default
             }
 
@@ -79,7 +79,7 @@
                 bool ok;
                 const int j = temp[i] = list.at(i).toInt(&ok);
                 if (!ok) { // failed to convert to int
-                    kError() << errString << " (integer conversion failed)" << endl;
+                    kError() << qPrintable(errString) << " (integer conversion failed)";
                     return true; // return default
                 }
                 if (j < 0 || j > 255) {
@@ -87,9 +87,8 @@
                         "red", "green", "blue", "alpha"
                     };
                     const QString boundsError = QLatin1String(" (bounds error: %1 component %2)");
-                    kError() << errString
-                             << boundsError.arg(components[i]).arg(j < 0? "< 0": "> 255")
-                             << endl;
+                    kError() << qPrintable(errString)
+                             << qPrintable(boundsError.arg(components[i]).arg(j < 0? "< 0": "> 255"));
                     return true; // return default
                 }
             }
@@ -100,7 +99,7 @@
             if (aColor.isValid())
                 output = aColor;
             else
-                kError() << errString << endl;
+                kError() << qPrintable(errString);
             return true;
         }
     }
@@ -110,7 +109,7 @@
         if (tmp.convert(QVariant::Font))
             output = tmp;
         else
-            kError() << errString << endl;
+            kError() << qPrintable(errString);
         return true;
     }
     case QVariant::Pixmap:
--- trunk/KDE/kdelibs/kdeui/tests/kconfigguitest.cpp #1205001:1205002
@@ -39,6 +39,9 @@
   // cheat the linker on windows to link against kdeui
   KCursor::hideCursorDelay();
 
+  setenv("KDE_DEBUG_NOPROCESSINFO", "1", 1);
+  setenv("KDE_DEBUG_TIMESTAMP", "0", 1);
+
   KConfig sc( "kconfigtest" );
 
   KConfigGroup cg(&sc, "ComplexTypes");
@@ -100,6 +103,7 @@
   sc3.writeEntry( QString("badList"), list);
   sc.sync();
 
+  QTest::ignoreMessage(QtWarningMsg, "QColor::setNamedColor: Unknown color name '1'");
   QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() );
 
   // 2 element list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic