Commit 7244aeb1 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Include clip markers and effect params in test hash function for better regression tracking

parent 741b84ba
Pipeline #107243 passed with stage
in 6 minutes and 5 seconds
......@@ -86,7 +86,7 @@ int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt
return id;
}
void ClipModel::allSnaps(std::vector<int> &snaps, int offset)
void ClipModel::allSnaps(std::vector<int> &snaps, int offset) const
{
m_clipMarkerModel->allSnaps(snaps, offset);
}
......@@ -1464,3 +1464,27 @@ FileStatus::ClipStatus ClipModel::clipStatus() const
std::shared_ptr<ProjectClip> binClip = pCore->projectItemModel()->getClipByBinID(m_binClipId);
return binClip->clipStatus();
}
QString ClipModel::clipHash() const
{
QDomDocument document;
QDomElement container = document.createElement(QStringLiteral("clip"));
container.setAttribute(QStringLiteral("service"), m_producer->parent().get("mlt_service"));
container.setAttribute(QStringLiteral("in"), getIn());
container.setAttribute(QStringLiteral("out"), getOut());
container.setAttribute(QStringLiteral("position"), getPosition());
container.setAttribute(QStringLiteral("state"), m_currentState);
container.setAttribute(QStringLiteral("playlist"), m_subPlaylistIndex);
container.setAttribute(QStringLiteral("speed"), QString::number(m_speed, 'f'));
container.setAttribute(QStringLiteral("audioStream"), getIntProperty(QStringLiteral("audio_index")));
std::vector<int> snaps;
allSnaps(snaps);
QString snapData;
for (auto &s : snaps) {
snapData.append(QString::number(s));
}
container.setAttribute(QStringLiteral("markers"), snapData);
document.appendChild(container);
container.appendChild(m_effectStack->toXml(document));
return document.toString();
}
......@@ -108,11 +108,13 @@ public:
QDomElement toXml(QDomDocument &document);
/** @brief Retrieve a list of all snaps for this clip */
void allSnaps(std::vector<int> &snaps, int offset = 0);
void allSnaps(std::vector<int> &snaps, int offset = 0) const;
protected:
/** @brief helper functions that creates the lambda */
Fun setClipState_lambda(PlaylistState::ClipState state);
/** @brief Returns a clip hash, useful for regression testing */
QString clipHash() const;
public:
/** @brief returns the length of the item on the timeline
......
......@@ -87,7 +87,7 @@ void ClipSnapModel::removeAllSnaps()
}
}
void ClipSnapModel::allSnaps(std::vector<int> &snaps, int offset)
void ClipSnapModel::allSnaps(std::vector<int> &snaps, int offset) const
{
snaps.push_back(m_position - offset);
if (auto ptr = m_registeredSnap.lock()) {
......
......@@ -38,7 +38,7 @@ public:
void updateSnapModelInOut(std::vector<int> borderSnaps);
void updateSnapMixPosition(int mixPos);
/** @brief Retrieve all snap points */
void allSnaps(std::vector<int> &snaps, int offset = 0);
void allSnaps(std::vector<int> &snaps, int offset = 0) const;
private:
......
......@@ -2596,8 +2596,7 @@ QByteArray TrackModel::trackHash()
QByteArray fileData;
// Parse clips
for (auto &clip : m_allClips) {
QString clipData = QString("%1 %2 %3 %4").arg(QString::number(clip.second->getPosition()), QString::number(clip.second->getPlaytime()), QString::number(clip.second->getSubPlaylistIndex()), clip.second->effectNames());
fileData.append(clipData.toLatin1());
fileData.append(clip.second->clipHash().toUtf8());
}
// Parse mixes
for (auto &sameComposition : m_sameCompositions) {
......
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