diff base/test/TestEventSeries.h @ 1635:e8e51f3ca120 single-point

Add getEventsWithin
author Chris Cannam
date Wed, 13 Mar 2019 10:01:02 +0000
parents 6ac92836cd86
children 7482da1cd920
line wrap: on
line diff
--- a/base/test/TestEventSeries.h	Wed Mar 13 10:00:49 2019 +0000
+++ b/base/test/TestEventSeries.h	Wed Mar 13 10:01:02 2019 +0000
@@ -427,6 +427,26 @@
         QCOMPARE(s.getEventsSpanning(6, 2), EventVector({ a, b, c, cc, d, dd }));
     }
 
+    void eventPatternWithin() {
+
+        EventSeries s;
+        Event a(0, 1.0f, 18, QString("a"));
+        Event b(3, 2.0f, 6, QString("b"));
+        Event c(5, 3.0f, 2, QString("c"));
+        Event cc(5, 3.1f, 2, QString("cc"));
+        Event d(6, 4.0f, 10, QString("d"));
+        Event dd(6, 4.5f, 10, QString("dd"));
+        Event e(14, 5.0f, 3, QString("e"));
+        s.add(b);
+        s.add(c);
+        s.add(d);
+        s.add(a);
+        s.add(cc);
+        s.add(dd);
+        s.add(e);
+        QCOMPARE(s.getEventsWithin(2, 7), EventVector({ b, c, cc }));
+    }
+
     void eventPatternAddRemove() {
 
         // This is mostly here to exercise the innards of EventSeries