← Back to team overview

ayatana-commits team mailing list archive

[Branch ~agateau/libindicate-qt/trunk] Rev 101: - Added test for time

 

------------------------------------------------------------
revno: 101
committer: Aurelien Gateau <aurelien.gateau@xxxxxxxxxxxxx>
branch nick: libindicate-qt
timestamp: Wed 2010-02-10 17:40:27 +0100
message:
  - Added test for time
  - Use ...get_property_value() instead of ...get_property() to avoid error
    message on stderr
modified:
  src/qindicateindicator.cpp
  tests/indicatortest.cpp
  tests/indicatortest.h


--
lp:libindicate-qt
https://code.launchpad.net/~agateau/libindicate-qt/trunk

Your team ayatana-commits is subscribed to branch lp:libindicate-qt.
To unsubscribe from this branch go to https://code.launchpad.net/~agateau/libindicate-qt/trunk/+edit-subscription.
=== modified file 'src/qindicateindicator.cpp'
--- src/qindicateindicator.cpp	2010-02-10 16:34:32 +0000
+++ src/qindicateindicator.cpp	2010-02-10 16:40:27 +0000
@@ -127,8 +127,8 @@
 
 QDateTime Indicator::dateTimeIndicatorProperty(const QString& key) const
 {
-    const gchar* value = indicate_indicator_get_property(d->mGIndicator, key.toUtf8().data());
-    return Decode::dateTimeFromValue(value);
+    const GValue* value = indicate_indicator_get_property_value(d->mGIndicator, key.toUtf8().data());
+    return value ? Decode::dateTimeFromValue(g_value_get_string(value)): QDateTime();
 }
 
 int Indicator::intIndicatorProperty(const QString& key, int defaultValue) const

=== modified file 'tests/indicatortest.cpp'
--- tests/indicatortest.cpp	2009-09-25 10:29:09 +0000
+++ tests/indicatortest.cpp	2010-02-10 16:40:27 +0000
@@ -101,6 +101,16 @@
     QVERIFY(!indicator.drawAttentionProperty());
 }
 
+void IndicatorTest::testTime()
+{
+    QIndicate::Indicator indicator;
+    QCOMPARE(indicator.timeProperty(), QDateTime());
+
+    QDateTime time = QDateTime(QDate(2010, 2, 10), QTime(17,37,5));
+    indicator.setTimeProperty(time);
+    QCOMPARE(indicator.timeProperty(), time);
+}
+
 void IndicatorTest::testDisplay()
 {
     QIndicate::Indicator indicator;

=== modified file 'tests/indicatortest.h'
--- tests/indicatortest.h	2009-09-11 15:50:33 +0000
+++ tests/indicatortest.h	2010-02-10 16:40:27 +0000
@@ -29,6 +29,7 @@
     void testDisplay();
     void testCount();
     void testDrawAttention();
+    void testTime();
 
 private:
     QIndicate::Server* mServer;