本文整理汇总了C++中QMediaTimeRange::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ QMediaTimeRange::isEmpty方法的具体用法?C++ QMediaTimeRange::isEmpty怎么用?C++ QMediaTimeRange::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMediaTimeRange
的用法示例。
在下文中一共展示了QMediaTimeRange::isEmpty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testAssignment
void tst_QMediaTimeRange::testAssignment()
{
QMediaTimeRange x;
// Range Assignment
x = QMediaTimeRange(10, 20);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 20);
// Interval Assignment
x = QMediaTimeInterval(30, 40);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 30);
QVERIFY(x.latestTime() == 40);
// Shared Data Check
QMediaTimeRange y;
y = x;
y.addInterval(10, 20);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 30);
QVERIFY(x.latestTime() == 40);
}
示例2: testCtor
void tst_QMediaTimeRange::testCtor()
{
// Default Ctor
QMediaTimeRange a;
QVERIFY(a.isEmpty());
// (qint, qint) Ctor
QMediaTimeRange b(10, 20);
QVERIFY(!b.isEmpty());
QVERIFY(b.isContinuous());
QVERIFY(b.earliestTime() == 10);
QVERIFY(b.latestTime() == 20);
// Interval Ctor
QMediaTimeRange c(QMediaTimeInterval(30, 40));
QVERIFY(!c.isEmpty());
QVERIFY(c.isContinuous());
QVERIFY(c.earliestTime() == 30);
QVERIFY(c.latestTime() == 40);
// Abnormal Interval Ctor
QMediaTimeRange d(QMediaTimeInterval(20, 10));
QVERIFY(d.isEmpty());
// Copy Ctor
QMediaTimeRange e(b);
QVERIFY(!e.isEmpty());
QVERIFY(e.isContinuous());
QVERIFY(e.earliestTime() == 10);
QVERIFY(e.latestTime() == 20);
}
示例3: testClear
void tst_QMediaTimeRange::testClear()
{
QMediaTimeRange x;
// Clear Nothing
x.clear();
QVERIFY(x.isEmpty());
// Clear Single
x = QMediaTimeRange(10, 20);
x.clear();
QVERIFY(x.isEmpty());
// Clear Multiple
x = QMediaTimeRange();
x.addInterval(10, 20);
x.addInterval(30, 40);
x.clear();
QVERIFY(x.isEmpty());
}
示例4: testGetters
void tst_QMediaTimeRange::testGetters()
{
QMediaTimeRange x;
// isEmpty
QVERIFY(x.isEmpty());
x.addInterval(10, 20);
// isEmpty + isContinuous
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
x.addInterval(30, 40);
// isEmpty + isContinuous + intervals + start + end
QVERIFY(!x.isEmpty());
QVERIFY(!x.isContinuous());
QVERIFY(x.intervals().count() == 2);
QVERIFY(x.intervals()[0].start() == 10);
QVERIFY(x.intervals()[0].end() == 20);
QVERIFY(x.intervals()[1].start() == 30);
QVERIFY(x.intervals()[1].end() == 40);
}
示例5: testRemoveInterval
void tst_QMediaTimeRange::testRemoveInterval()
{
// Removing an interval, causing a split
QMediaTimeRange x;
x.addInterval(10, 50);
x.removeInterval(20, 40);
QVERIFY(!x.isEmpty());
QVERIFY(!x.isContinuous());
QVERIFY(x.intervals().count() == 2);
QVERIFY(x.intervals()[0].start() == 10);
QVERIFY(x.intervals()[0].end() == 19);
QVERIFY(x.intervals()[1].start() == 41);
QVERIFY(x.intervals()[1].end() == 50);
// Removing an interval, causing a deletion
x = QMediaTimeRange();
x.addInterval(20, 30);
x.removeInterval(10, 40);
QVERIFY(x.isEmpty());
// Removing an interval, causing a tail trim
x = QMediaTimeRange();
x.addInterval(20, 40);
x.removeInterval(30, 50);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 20);
QVERIFY(x.latestTime() == 29);
// Removing an interval, causing a head trim
x = QMediaTimeRange();
x.addInterval(20, 40);
x.removeInterval(10, 30);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 31);
QVERIFY(x.latestTime() == 40);
// Identical Remove
x = QMediaTimeRange();
x.addInterval(10, 20);
x.removeInterval(10, 20);
QVERIFY(x.isEmpty());
// Multi-Trim
x = QMediaTimeRange();
x.addInterval(10, 20);
x.addInterval(30, 40);
x.removeInterval(15, 35);
QVERIFY(!x.isEmpty());
QVERIFY(!x.isContinuous());
QVERIFY(x.intervals().count() == 2);
QVERIFY(x.intervals()[0].start() == 10);
QVERIFY(x.intervals()[0].end() == 14);
QVERIFY(x.intervals()[1].start() == 36);
QVERIFY(x.intervals()[1].end() == 40);
// Multi-Delete
x = QMediaTimeRange();
x.addInterval(10, 20);
x.addInterval(30, 40);
x.addInterval(50, 60);
x.removeInterval(10, 60);
QVERIFY(x.isEmpty());
// Interval Parameter - Removing an interval, causing a split
x = QMediaTimeRange();
x.addInterval(10, 50);
x.removeInterval(QMediaTimeInterval(20, 40));
QVERIFY(!x.isEmpty());
QVERIFY(!x.isContinuous());
QVERIFY(x.intervals().count() == 2);
QVERIFY(x.intervals()[0].start() == 10);
QVERIFY(x.intervals()[0].end() == 19);
QVERIFY(x.intervals()[1].start() == 41);
QVERIFY(x.intervals()[1].end() == 50);
// Interval Parameter - Abnormal Interval
x = QMediaTimeRange();
x.addInterval(10, 40);
x.removeInterval(QMediaTimeInterval(30, 20));
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 40);
}
示例6: testAddInterval
void tst_QMediaTimeRange::testAddInterval()
{
// All intervals Overlap
QMediaTimeRange x;
x.addInterval(10, 40);
x.addInterval(30, 50);
x.addInterval(20, 60);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 60);
// 1 adjacent interval, 1 encompassed interval
x = QMediaTimeRange();
x.addInterval(10, 40);
x.addInterval(20, 30);
x.addInterval(41, 50);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 50);
// 1 overlapping interval, 1 disjoint interval
x = QMediaTimeRange();
x.addInterval(10, 30);
x.addInterval(20, 40);
x.addInterval(50, 60);
QVERIFY(!x.isEmpty());
QVERIFY(!x.isContinuous());
QVERIFY(x.intervals().count() == 2);
QVERIFY(x.intervals()[0].start() == 10);
QVERIFY(x.intervals()[0].end() == 40);
QVERIFY(x.intervals()[1].start() == 50);
QVERIFY(x.intervals()[1].end() == 60);
// Identical Add
x = QMediaTimeRange();
x.addInterval(10, 20);
x.addInterval(10, 20);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 20);
// Multi-Merge
x = QMediaTimeRange();
x.addInterval(10, 20);
x.addInterval(30, 40);
x.addInterval(50, 60);
x.addInterval(15, 55);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 60);
// Interval Parameter - All intervals Overlap
x = QMediaTimeRange();
x.addInterval(QMediaTimeInterval(10, 40));
x.addInterval(QMediaTimeInterval(30, 50));
x.addInterval(QMediaTimeInterval(20, 60));
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 60);
// Interval Parameter - Abnormal Interval
x = QMediaTimeRange();
x.addInterval(QMediaTimeInterval(20, 10));
QVERIFY(x.isEmpty());
}