Commit 78f59f33 authored by Nicolas Carion's avatar Nicolas Carion

Add snap consistency test in timeline tests

parent 20b4137e
......@@ -70,6 +70,9 @@ public:
*/
int proposeSize(int in, int out, int size, bool right, int maxSnapDist);
// For testing only
std::map<int, int> _snaps() { return m_snaps;}
private:
std::map<int, int> m_snaps; // This represents the snappoints internally. The keys are the positions and the values are the number of elements at this
// position. Note that it is important that the datastructure is ordered. QMap is NOT ordered, and therefore not suitable.
......
......@@ -1505,6 +1505,8 @@ bool TimelineModel::checkConsistency()
}
}
// We store all in/outs of clips to check snap points
std::map<int, int> snaps;
//Check parent/children link for clips
for (const auto &cp : m_allClips) {
auto clip = (cp.second);
......@@ -1518,6 +1520,21 @@ bool TimelineModel::checkConsistency()
qDebug() << "NULL parent for clip" << cp.first;
return false;
}
if (getClipTrackId(cp.first) != -1) {
snaps[clip->getPosition()] += 1;
snaps[clip->getPosition() + clip->getPlaytime()] += 1;
}
}
// Check snaps
if (snaps.size() != m_snaps->_snaps().size()) {
qDebug() << "Wrong number of snaps";
return false;
}
for (auto i = snaps.begin(), j = m_snaps->_snaps().begin(); i != snaps.end(); ++i, ++j) {
if (*i != *j) {
qDebug() << "Wrong snap info at point"<<(*i).first;
return false;
}
}
// We check consistency with bin model
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment