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

Add test method to create title clip

parent fa7d1da6
Pipeline #174374 passed with stage
in 9 minutes and 46 seconds
<kdenlivetitle duration="125" LC_NUMERIC="C" width="1920" height="1080" out="125">
<item type="QGraphicsTextItem" z-index="0">
<position x="548" y="376">
<transform>1,0,0,0,1,0,0,0,1</transform>
</position>
<content shadow="0;#64000000;3;3;3" font-underline="0" box-height="197" font-outline-color="0,0,0,255" font="Noto Sans" letter-spacing="0" font-pixel-size="144" font-italic="0" typewriter="0;2;1;0;0" alignment="0" font-weight="75" font-outline="2" box-width="835.516" font-color="95,255,67,255">Hello World</content>
</item>
<startviewport rect="0,0,1920,1080"/>
<endviewport rect="0,0,1920,1080"/>
<background color="0,0,0,0"/>
</kdenlivetitle>
......@@ -22,8 +22,7 @@ QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<Pr
QString createProducerWithSound(Mlt::Profile &prof, std::shared_ptr<ProjectItemModel> binModel, int length)
{
// std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof,
// QFileInfo("../tests/small.mkv").absoluteFilePath().toStdString().c_str());
// std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, QFileInfo(QCoreApplication::applicationDirPath() + "/../../tests/small.mkv").absoluteFilePath().toStdString().c_str());
// In case the test system does not have avformat support, we can switch to the integrated blipflash producer
std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, "blipflash");
......@@ -42,3 +41,24 @@ QString createProducerWithSound(Mlt::Profile &prof, std::shared_ptr<ProjectItemM
return binId;
}
QString createTextProducer(Mlt::Profile &prof, std::shared_ptr<ProjectItemModel> binModel, int length)
{
std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, QFileInfo(QCoreApplication::applicationDirPath() + "/../../tests/dataset/title.kdenlivetitle").absoluteFilePath().toStdString().c_str());
REQUIRE(producer->is_valid());
producer->set("length", length);
producer->set_in_and_out(0, length - 1);
producer->set("kdenlive:duration", length);
producer->set("length", length);
QString binId = QString::number(binModel->getFreeClipId());
auto binClip = ProjectClip::construct(binId, QIcon(), binModel, producer);
binClip->forceLimitedDuration();
Fun undo = []() { return true; };
Fun redo = []() { return true; };
REQUIRE(binModel->addItem(binClip, binModel->getRootFolder()->clipId(), undo, redo));
REQUIRE(binClip->clipType() == ClipType::TextTemplate);
return binId;
}
......@@ -85,3 +85,5 @@ using namespace fakeit;
QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<ProjectItemModel> binModel, int length = 20, bool limited = true);
QString createProducerWithSound(Mlt::Profile &prof, std::shared_ptr<ProjectItemModel> binModel, int length = 10);
QString createTextProducer(Mlt::Profile &prof, std::shared_ptr<ProjectItemModel> binModel, int length = 10);
Supports Markdown
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