Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
eab78ff7
Commit
eab78ff7
authored
Nov 08, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix mix tests
parent
89a4bdf2
Pipeline
#95131
canceled with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
eab78ff7
...
...
@@ -3300,9 +3300,11 @@ bool TimelineModel::requestItemResize(int itemId, int size, bool right, bool log
return
true
;
};
Fun
local_update_undo
=
[
this
,
itemId
,
tid
,
mixData
,
currentMixDuration
]
{
getTrackById_const
(
tid
)
->
setMixDuration
(
itemId
,
currentMixDuration
,
mixData
.
first
.
mixOffset
);
QModelIndex
ix
=
makeClipIndexFromID
(
itemId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MixRole
,
TimelineModel
::
MixCutRole
});
if
(
getTrackById_const
(
tid
)
->
hasStartMix
(
itemId
))
{
getTrackById_const
(
tid
)
->
setMixDuration
(
itemId
,
currentMixDuration
,
mixData
.
first
.
mixOffset
);
QModelIndex
ix
=
makeClipIndexFromID
(
itemId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MixRole
,
TimelineModel
::
MixCutRole
});
}
return
true
;
};
local_update
();
...
...
src/timeline2/model/trackmodel.cpp
View file @
eab78ff7
...
...
@@ -686,7 +686,7 @@ Fun TrackModel::requestClipResize_lambda(int clipId, int in, int out, bool right
};
}
int
blank
=
-
1
;
int
other_blank_end
=
getBlankEnd
(
clip_position
,
(
target_track
+
1
)
%
2
);
int
other_blank_end
=
getBlankEnd
(
clip_position
,
1
-
target_track
);
if
(
right
)
{
if
(
target_clip
==
m_playlists
[
target_track
].
count
()
-
1
&&
(
hasMix
||
other_blank_end
>=
out
))
{
// clip is last, it can always be extended
...
...
tests/mixtest.cpp
View file @
eab78ff7
...
...
@@ -73,6 +73,7 @@ TEST_CASE("Simple Mix", "[SameTrackMix]")
REQUIRE
(
timeline
->
requestItemResize
(
cid3
,
20
,
true
,
true
));
REQUIRE
(
timeline
->
requestClipInsertion
(
binId2
,
tid2
,
520
,
cid4
));
REQUIRE
(
timeline
->
requestItemResize
(
cid4
,
20
,
true
,
true
));
int
mixDuration
=
pCore
->
getDurationFromString
(
KdenliveSettings
::
mix_duration
());
auto
state0
=
[
&
]()
{
REQUIRE
(
timeline
->
getClipsCount
()
==
6
);
...
...
@@ -99,12 +100,13 @@ TEST_CASE("Simple Mix", "[SameTrackMix]")
REQUIRE
(
timeline
->
getTrackById_const
(
tid2
)
->
mixCount
()
==
1
);
};
auto
state3
=
[
&
]()
{
auto
state3
=
[
&
,
mixDuration
]()
{
REQUIRE
(
timeline
->
getClipsCount
()
==
6
);
REQUIRE
(
timeline
->
getClipPlaytime
(
cid1
)
>
30
);
REQUIRE
(
timeline
->
getClipPosition
(
cid1
)
==
100
);
REQUIRE
(
timeline
->
getClipPlaytime
(
cid2
)
>
30
);
REQUIRE
(
timeline
->
getClipPosition
(
cid2
)
<
130
);
REQUIRE
(
timeline
->
m_allClips
[
cid2
]
->
getMixDuration
()
==
mixDuration
);
REQUIRE
(
timeline
->
getTrackById_const
(
tid3
)
->
mixCount
()
==
1
);
REQUIRE
(
timeline
->
getTrackById_const
(
tid2
)
->
mixCount
()
==
1
);
};
...
...
@@ -167,7 +169,7 @@ TEST_CASE("Simple Mix", "[SameTrackMix]")
state0
();
}
/*
SECTION("Create mix on color clip and move left side clip")
SECTION
(
"Create mix on color clip and move left side clip"
)
{
state0
();
REQUIRE
(
timeline
->
mixClip
(
cid4
));
...
...
@@ -256,11 +258,17 @@ TEST_CASE("Simple Mix", "[SameTrackMix]")
// Resize clip, should resize the mix
state0
();
REQUIRE
(
timeline
->
mixClip
(
cid2
));
//state1();
// Move clip inside mix zone, should resize the mix
REQUIRE(timeline->requestClipMove(cid2, tid2, 105));
REQUIRE(timeline->getTrackById_const(tid3)->mixCount() == 0);
REQUIRE(timeline->getTrackById_const(tid2)->mixCount() == 0);
state1
();
// Resize right clip, should resize the mix
REQUIRE
(
timeline
->
requestItemResize
(
cid2
,
15
,
false
,
true
)
==
15
);
REQUIRE
(
timeline
->
getTrackById_const
(
tid3
)
->
mixCount
()
==
1
);
REQUIRE
(
timeline
->
getTrackById_const
(
tid2
)
->
mixCount
()
==
1
);
undoStack
->
undo
();
state1
();
// Resize left clip, should resize the mix
REQUIRE
(
timeline
->
requestItemResize
(
cid1
,
20
,
true
,
true
)
==
20
);
REQUIRE
(
timeline
->
getTrackById_const
(
tid3
)
->
mixCount
()
==
1
);
REQUIRE
(
timeline
->
getTrackById_const
(
tid2
)
->
mixCount
()
==
1
);
undoStack
->
undo
();
state1
();
// Move clip outside mix zone, should delete the mix
...
...
@@ -377,14 +385,15 @@ TEST_CASE("Simple Mix", "[SameTrackMix]")
REQUIRE
(
timeline
->
requestClipInsertion
(
binId2
,
tid2
,
540
,
cid5
));
REQUIRE
(
timeline
->
requestItemResize
(
cid5
,
20
,
true
,
true
));
REQUIRE
(
timeline
->
requestClipInsertion
(
binId2
,
tid2
,
560
,
cid6
));
REQUIRE(timeline->requestItemResize(cid6,
2
0, true, true));
REQUIRE(timeline->requestClipInsertion(binId2, tid2,
58
0, cid7));
REQUIRE
(
timeline
->
requestItemResize
(
cid6
,
4
0
,
true
,
true
));
REQUIRE
(
timeline
->
requestClipInsertion
(
binId2
,
tid2
,
60
0
,
cid7
));
REQUIRE
(
timeline
->
requestItemResize
(
cid7
,
20
,
true
,
true
));
// Cid3 pos=500, duration=20
// Cid4 pos=520, duration=20
// Cid5 pos=540, duration=20
// Cid6 pos=560, duration=20
// Cid6 pos=560, duration=40
// Cid7 pos=600, duration=20
// Mix 3 and 4
REQUIRE
(
timeline
->
mixClip
(
cid4
));
...
...
@@ -430,7 +439,7 @@ TEST_CASE("Simple Mix", "[SameTrackMix]")
REQUIRE
(
timeline
->
m_allClips
[
cid6
]
->
getSubPlaylistIndex
()
==
0
);
REQUIRE
(
timeline
->
m_allClips
[
cid7
]
->
getSubPlaylistIndex
()
==
0
);
REQUIRE
(
timeline
->
getTrackById_const
(
tid2
)
->
mixCount
()
==
1
);
// Undo mix 3 and 4
undoStack
->
undo
();
...
...
@@ -444,7 +453,6 @@ TEST_CASE("Simple Mix", "[SameTrackMix]")
state0
();
}
*/
binModel
->
clean
();
pCore
->
m_projectManager
=
nullptr
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment