Branch 'c++/master' - 2 commits - c++/lib c++/tests

Christian Mollekopf mollekopf at kolabsys.com
Thu Dec 29 14:23:33 CET 2011


 c++/lib/test.php           |   14 ++++++++++++--
 c++/lib/xcalconversions.h  |    2 +-
 c++/tests/bindingstest.cpp |    7 +++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit ddc1de13c5ad58dc28172f6d5819929c3ac24da3
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Thu Dec 29 14:23:29 2011 +0100

    add recurrencerule to example

diff --git a/c++/lib/test.php b/c++/lib/test.php
index 7a5e36b..f3f514e 100644
--- a/c++/lib/test.php
+++ b/c++/lib/test.php
@@ -4,11 +4,21 @@
 include("kolabformat.php");
 
 $e = new Event();
-$d = new c_DateTime(1,1,1);
+$d = new c_DateTime(2009,10,12);
 print $e->exceptionDates()->size();
-$e->addExceptionDate( $d);
+$e->addExceptionDate($d);
 print $e->exceptionDates()->size();
 
+$r = new RecurrenceRule();
+$r->setFrequency(RecurrenceRule::Minutely);
+
+$bysec = new vectori();
+$bysec->push(1);
+$bysec->push(3);
+
+$r->setBySecond($bysec);
+$e->setRecurrenceRule($r);
+
 $string = writeEvent($e);
 print $string;
 $e1 = readEvent($string, false);


commit 98d4dff56b78d066ff5690e506f38f6c9abacd2b
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Thu Dec 29 14:23:03 2011 +0100

    Fix bysecond

diff --git a/c++/lib/xcalconversions.h b/c++/lib/xcalconversions.h
index 2d81baa..26e3f17 100644
--- a/c++/lib/xcalconversions.h
+++ b/c++/lib/xcalconversions.h
@@ -452,7 +452,7 @@ void setIncidenceProperties(I &inc, const T &prop)
 template <typename T, typename I>
 T fromList(const std::vector<int> &input) {
     T list;
-    BOOST_FOREACH(int i, list) {
+    BOOST_FOREACH(int i, input) {
         list.push_back(convertToInt<I>(i));
     }
     return list;
diff --git a/c++/tests/bindingstest.cpp b/c++/tests/bindingstest.cpp
index 0690785..f8b5619 100644
--- a/c++/tests/bindingstest.cpp
+++ b/c++/tests/bindingstest.cpp
@@ -116,6 +116,10 @@ void setIncidence(T &ev)
     Kolab::RecurrenceRule rule;
     rule.setFrequency(Kolab::RecurrenceRule::Daily);
     rule.setCount(5);
+    std::vector<int> list;
+    list.push_back(1);
+    list.push_back(3);
+    rule.setBysecond(list);
     ev.setRecurrenceRule(rule);
     ev.addRecurrenceDate(Kolab::DateTime("US/Eastern", 2006,1,6,12,0,0));
     ev.addExceptionDate(Kolab::DateTime("US/Eastern", 2006,1,6,12,0,0));
@@ -151,6 +155,9 @@ void checkIncidence(const T &ev, const T &re)
     QCOMPARE(r1.weekStart(), r2.weekStart());
     QCOMPARE(r1.count(), r2.count());
     QCOMPARE(r1.end(), r2.end());
+    QCOMPARE(r1.bysecond().size(), r2.bysecond().size());
+    QCOMPARE(r1.bysecond().at(0), r2.bysecond().at(0));
+    QCOMPARE(r1.bysecond().at(1), r2.bysecond().at(1));
     
     QCOMPARE(ev.recurrenceDates().size(), re.recurrenceDates().size());
     QCOMPARE(ev.recurrenceDates().at(0), re.recurrenceDates().at(0));





More information about the commits mailing list