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

List:       kde-commits
Subject:    koffice/libs/kotext
From:       Thomas Zander <zander () kde ! org>
Date:       2010-09-11 11:34:37
Message-ID: 20100911113437.8878FAC891 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1174141 by zander:

Update the list test code verbosity

I print more now and am more strict in checking all properties.

 M  +35 -4     opendocument/tests/TestLoading.cpp  
 M  +1 -0      styles/KoListStyle.h  


--- trunk/koffice/libs/kotext/opendocument/tests/TestLoading.cpp #1174140:1174141
@@ -250,17 +250,48 @@
 {
     QMap<int, QVariant> actualProperties = actualFormat.properties();
     actualProperties.remove(KoListStyle::StyleId);
-    actualProperties.remove(KoListStyle::Indent);
-    actualProperties.remove(KoListStyle::MinimumWidth);
     actualProperties.remove(KoListStyle::MinimumDistance);
     actualProperties.remove(KoListStyle::ListId);
+    actualProperties.remove(QTextFormat::ObjectIndex);
 
     QMap<int, QVariant> expectedProperties = expectedFormat.properties();
     expectedProperties.remove(KoListStyle::StyleId);
-    expectedProperties.remove(KoListStyle::Indent);
-    expectedProperties.remove(KoListStyle::MinimumWidth);
     expectedProperties.remove(KoListStyle::MinimumDistance);
     expectedProperties.remove(KoListStyle::ListId);
+    expectedProperties.remove(QTextFormat::ObjectIndex);
+
+
+    struct Enum {
+        static QString resolve(int key) {
+            QMetaObject meta;
+            if (key >= QTextFormat::UserProperty)
+                meta = KoListStyle::staticMetaObject;
+            else
+                meta = QTextFormat::staticMetaObject;
+            QMetaEnum me = meta.enumerator(meta.indexOfEnumerator("Property"));
+            QString answer(me.valueToKey(key));
+            if (answer.isEmpty())
+                answer = QString::number(key);
+            return answer;
+        }
+    };
+
+    foreach (int key, expectedProperties.keys()) {
+        if (actualProperties.contains(key)) {
+            if (actualProperties.value(key) != expectedProperties.value(key)) {
+                qDebug() << "properties don't match;" << Enum::resolve(key)
+                    << actualProperties.value(key) << expectedProperties.value(key);
+            }
+        } else {
+            qDebug() << "Expected but missing property;" << Enum::resolve(key);
+        }
+    }
+    foreach (int key, actualProperties.keys()) {
+        if (!expectedProperties.contains(key)) {
+            qDebug() << "found extra property;" << Enum::resolve(key);
+        }
+    }
+
     return actualProperties == expectedProperties;
 }
 
--- trunk/koffice/libs/kotext/styles/KoListStyle.h #1174140:1174141
@@ -57,6 +57,7 @@
 class  KOTEXT_EXPORT KoListStyle : public QObject
 {
     Q_OBJECT
+    Q_ENUMS(Style Property)
 public:
     // ListIdType will be 32-bit in 32 bit machines and 64 bit in 64 bit machines
     typedef quintptr ListIdType;
[prev in list] [next in list] [prev in thread] [next in thread] 

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