Commit 2a0641ae authored by Nicolas Carion's avatar Nicolas Carion

fix ClipModel tests

parent acb1d24a
......@@ -156,7 +156,7 @@ QString producerXml(const std::shared_ptr<Mlt::Producer> &producer, bool include
}
return QString::fromUtf8(c.get("string"));
}
}
} // namespace
void ClipController::getProducerXML(QDomDocument &document, bool includeMeta)
{
......@@ -233,6 +233,11 @@ bool ClipController::hasLimitedDuration() const
return m_hasLimitedDuration;
}
void ClipController::forceLimitedDuration()
{
m_hasLimitedDuration = true;
}
std::shared_ptr<Mlt::Producer> ClipController::originalProducer()
{
QMutexLocker lock(&m_producerLock);
......@@ -664,10 +669,8 @@ void ClipController::addEffect(QDomElement &xml)
*/
}
void ClipController::removeEffect(int effectIndex, bool delayRefresh)
{
Q_UNUSED(effectIndex)
Q_UNUSED(delayRefresh)
void ClipController::removeEffect(int effectIndex, bool delayRefresh){
Q_UNUSED(effectIndex) Q_UNUSED(delayRefresh)
// TODO refac: this must be rewritten
/*
QMutexLocker lock(&m_effectMutex);
......@@ -698,7 +701,6 @@ void ClipController::moveEffect(int oldPos, int newPos)
*/
}
int ClipController::effectsCount()
{
int count = 0;
......
......@@ -160,6 +160,7 @@ public:
void setZone(const QPoint &zone);
QPoint zone() const;
bool hasLimitedDuration() const;
void forceLimitedDuration();
Mlt::Properties &properties();
void initEffect(QDomElement &xml);
void addEffect(QDomElement &xml);
......
......@@ -91,7 +91,7 @@ ClipModel::~ClipModel()
bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool logUndo)
{
QWriteLocker locker(&m_lock);
//qDebug() << "RESIZE CLIP" << m_id << "target size=" << size << "right=" << right << "endless=" << m_endlessResize << "length" << m_producer->get_length();
// qDebug() << "RESIZE CLIP" << m_id << "target size=" << size << "right=" << right << "endless=" << m_endlessResize << "total length" << m_producer->get_length() << "current length" << getPlaytime();
if (!m_endlessResize && (size <= 0 || size > m_producer->get_length())) {
return false;
}
......@@ -114,7 +114,7 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
} else {
in += delta;
}
//qDebug() << "Resize facts delta =" << delta << "old in" << old_in << "old_out" << old_out << "in" << in << "out" << out;
// qDebug() << "Resize facts delta =" << delta << "old in" << old_in << "old_out" << old_out << "in" << in << "out" << out;
std::function<bool(void)> track_operation = []() { return true; };
std::function<bool(void)> track_reverse = []() { return true; };
int outPoint = out;
......
......@@ -349,7 +349,8 @@ public:
/* @brief Change the duration of an item (clip or composition)
This action is undoable
Returns true on success. If it fails, nothing is modified.
Returns the real size reached (can be different, if snapping occurs).
If it fails, nothing is modified, and -1 is returned
@param itemId is the ID of the item
@param size is the new size of the item
@param right is true if we change the right side of the item, false otherwise
......
This diff is collapsed.
#include "test_utils.hpp"
QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<ProjectItemModel> binModel, int length)
QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<ProjectItemModel> binModel, int length, bool limited)
{
std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, "color", color.c_str());
producer->set("length", length);
......@@ -10,6 +10,9 @@ QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<Pr
QString binId = QString::number(binModel->getFreeClipId());
auto binClip = ProjectClip::construct(binId, QIcon(), binModel, producer);
if (limited) {
binClip->forceLimitedDuration();
}
Fun undo = []() { return true; };
Fun redo = []() { return true; };
REQUIRE(binModel->addItem(binClip, binModel->getRootFolder()->clipId(), undo, redo));
......
......@@ -73,4 +73,4 @@ using namespace fakeit;
Verify(OverloadedMethod(timMock, notifyChange, void(const QModelIndex &, const QModelIndex &, bool, bool, bool))).Exactly(times); \
NO_OTHERS();
QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<ProjectItemModel> binModel, int length = 20);
QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<ProjectItemModel> binModel, int length = 20, bool limited = true);
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