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
0a053c1f
Commit
0a053c1f
authored
Dec 13, 2019
by
Jean-Baptiste Mardelle
Browse files
Fix tests
parent
e1af19ea
Pipeline
#11818
passed with stage
in 15 minutes and 31 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelineitemmodel.cpp
View file @
0a053c1f
...
...
@@ -565,20 +565,23 @@ void TimelineItemModel::buildTrackCompositing(bool rebuild)
// Make sure all previous track compositing is removed
if
(
rebuild
)
{
QScopedPointer
<
Mlt
::
Service
>
service
(
new
Mlt
::
Service
(
field
->
get_service
()));
while
(
(
service
!=
nullptr
)
&&
service
->
is_valid
())
{
while
(
service
!=
nullptr
&&
service
->
is_valid
())
{
if
(
service
->
type
()
==
transition_type
)
{
Mlt
::
Transition
t
((
mlt_transition
)
service
->
get_service
());
QString
serviceName
=
t
.
get
(
"mlt_service"
);
if
(
t
.
get_int
(
"internal_added"
)
==
237
)
{
// remove all compositing transitions
field
->
disconnect_service
(
t
);
t
.
disconnect_all_producers
();
}
}
service
.
reset
(
service
->
producer
());
}
}
QString
composite
=
TransitionsRepository
::
get
()
->
getCompositingTransition
();
pCore
->
mixer
()
->
cleanup
();
bool
hasMixer
=
pCore
->
mixer
()
!=
nullptr
;
if
(
hasMixer
)
{
pCore
->
mixer
()
->
cleanup
();
}
while
(
it
!=
m_allTracks
.
cend
())
{
int
trackPos
=
getTrackMltIndex
((
*
it
)
->
getId
());
if
(
!
composite
.
isEmpty
()
&&
!
(
*
it
)
->
isAudioTrack
())
{
...
...
@@ -596,7 +599,9 @@ void TimelineItemModel::buildTrackCompositing(bool rebuild)
transition
->
set
(
"sum"
,
1
);
field
->
plant_transition
(
*
transition
,
0
,
trackPos
);
transition
->
set_tracks
(
0
,
trackPos
);
pCore
->
mixer
()
->
registerTrack
((
*
it
)
->
getId
(),
(
*
it
)
->
getTrackService
(),
getTrackTagById
((
*
it
)
->
getId
()));
if
(
hasMixer
)
{
pCore
->
mixer
()
->
registerTrack
((
*
it
)
->
getId
(),
(
*
it
)
->
getTrackService
(),
getTrackTagById
((
*
it
)
->
getId
()));
}
}
++
it
;
}
...
...
src/timeline2/model/timelinemodel.cpp
View file @
0a053c1f
...
...
@@ -3127,8 +3127,18 @@ bool TimelineModel::checkConsistency()
while
(
nextservice
!=
nullptr
)
{
if
(
mlt_type
==
transition_type
)
{
auto
tr
=
(
mlt_transition
)
nextservice
;
if
(
mlt_properties_get_int
(
MLT_TRANSITION_PROPERTIES
(
tr
),
"internal_added"
)
>
0
)
{
// Skip track compositing
nextservice
=
mlt_service_producer
(
nextservice
);
continue
;
}
int
currentTrack
=
mlt_transition_get_b_track
(
tr
);
int
currentATrack
=
mlt_transition_get_a_track
(
tr
);
if
(
currentTrack
==
currentATrack
)
{
// Skip invalid transitions created by MLT on track deletion
nextservice
=
mlt_service_producer
(
nextservice
);
continue
;
}
int
currentIn
=
(
int
)
mlt_transition_get_in
(
tr
);
int
currentOut
=
(
int
)
mlt_transition_get_out
(
tr
);
...
...
@@ -3145,7 +3155,7 @@ bool TimelineModel::checkConsistency()
}
if
(
foundId
==
-
1
)
{
qDebug
()
<<
"Error, we didn't find matching composition IN: "
<<
currentIn
<<
", OUT: "
<<
currentOut
<<
", TRACK: "
<<
currentTrack
<<
" / "
<<
currentATrack
;
<<
currentATrack
<<
", SERVICE: "
<<
mlt_properties_get
(
MLT_TRANSITION_PROPERTIES
(
tr
),
"mlt_service"
)
<<
"
\n
ID: "
<<
mlt_properties_get
(
MLT_TRANSITION_PROPERTIES
(
tr
),
"id"
)
;
field
->
unlock
();
return
false
;
}
...
...
tests/modeltest.cpp
View file @
0a053c1f
...
...
@@ -29,29 +29,24 @@ TEST_CASE("Basic creation/deletion of a track", "[TrackModel]")
Fake
(
Method
(
timMock
,
adjustAssetRange
));
// This is faked to allow to count calls
Fake
(
Method
(
timMock
,
_resetView
));
int
id1
,
id2
,
id3
;
REQUIRE
(
timeline
->
requestTrackInsertion
(
-
1
,
id1
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
1
);
REQUIRE
(
timeline
->
getTrackPosition
(
id1
)
==
0
);
// In the current implementation, when a track is added/removed, the model is notified with _resetView
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
REQUIRE
(
timeline
->
requestTrackInsertion
(
-
1
,
id2
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
2
);
REQUIRE
(
timeline
->
getTrackPosition
(
id2
)
==
1
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
REQUIRE
(
timeline
->
requestTrackInsertion
(
-
1
,
id3
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
3
);
REQUIRE
(
timeline
->
getTrackPosition
(
id3
)
==
2
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
int
id4
;
...
...
@@ -62,33 +57,28 @@ TEST_CASE("Basic creation/deletion of a track", "[TrackModel]")
REQUIRE
(
timeline
->
getTrackPosition
(
id4
)
==
1
);
REQUIRE
(
timeline
->
getTrackPosition
(
id2
)
==
2
);
REQUIRE
(
timeline
->
getTrackPosition
(
id3
)
==
3
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
// Test deletion
REQUIRE
(
timeline
->
requestTrackDeletion
(
id3
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
3
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
REQUIRE
(
timeline
->
requestTrackDeletion
(
id1
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
2
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
REQUIRE
(
timeline
->
requestTrackDeletion
(
id4
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
1
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
// We are not allowed to delete the last track
REQUIRE_FALSE
(
timeline
->
requestTrackDeletion
(
id2
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
1
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
0
);
RESET
(
timMock
);
SECTION
(
"Delete a track with groups"
)
...
...
@@ -202,7 +192,6 @@ TEST_CASE("Clip manipulation", "[ClipModel]")
Fake
(
Method
(
timMock
,
adjustAssetRange
));
// This is faked to allow to count calls
Fake
(
Method
(
timMock
,
_resetView
));
Fake
(
Method
(
timMock
,
_beginInsertRows
));
Fake
(
Method
(
timMock
,
_beginRemoveRows
));
Fake
(
Method
(
timMock
,
_endInsertRows
));
...
...
@@ -223,7 +212,6 @@ TEST_CASE("Clip manipulation", "[ClipModel]")
int
cid4
=
ClipModel
::
construct
(
timeline
,
binId2
,
-
1
,
PlaylistState
::
VideoOnly
);
int
cid5
=
ClipModel
::
construct
(
timeline
,
binId_unlimited
,
-
1
,
PlaylistState
::
VideoOnly
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
3
_Times
);
RESET
(
timMock
);
SECTION
(
"Endless clips can be resized both sides"
)
...
...
@@ -887,16 +875,21 @@ TEST_CASE("Clip manipulation", "[ClipModel]")
REQUIRE
(
timeline
->
getTrackClipsCount
(
tid2
)
==
1
);
REQUIRE
(
timeline
->
getClipTrackId
(
cid1
)
==
tid1
);
REQUIRE
(
timeline
->
getClipTrackId
(
cid2
)
==
tid2
);
REQUIRE
(
timeline
->
getClipPosition
(
cid1
)
==
10
);
REQUIRE
(
timeline
->
getClipPosition
(
cid2
)
==
12
);
};
state
();
REQUIRE_FALSE
(
timeline
->
requestClipMove
(
cid2
,
tid1
,
10
));
// Moving clips on an unavailable track will do a same track move
REQUIRE
(
timeline
->
requestClipMove
(
cid2
,
tid1
,
10
));
REQUIRE
(
timeline
->
getClipPosition
(
cid1
)
==
8
);
REQUIRE
(
timeline
->
getClipPosition
(
cid2
)
==
10
);
state
();
REQUIRE_FALSE
(
timeline
->
requestClipMove
(
cid2
,
tid1
,
100
));
REQUIRE
(
timeline
->
requestClipMove
(
cid2
,
tid1
,
100
));
REQUIRE
(
timeline
->
getClipPosition
(
cid1
)
==
98
);
REQUIRE
(
timeline
->
getClipPosition
(
cid2
)
==
100
);
state
();
REQUIRE_FALSE
(
timeline
->
requestClipMove
(
cid1
,
tid3
,
100
));
REQUIRE
(
timeline
->
requestClipMove
(
cid1
,
tid3
,
100
));
REQUIRE
(
timeline
->
getClipPosition
(
cid1
)
==
100
);
REQUIRE
(
timeline
->
getClipPosition
(
cid2
)
==
102
);
state
();
}
...
...
@@ -1880,7 +1873,6 @@ TEST_CASE("Operations under locked tracks", "[Locked]")
Fake
(
Method
(
timMock
,
adjustAssetRange
));
// This is faked to allow to count calls
Fake
(
Method
(
timMock
,
_resetView
));
Fake
(
Method
(
timMock
,
_beginInsertRows
));
Fake
(
Method
(
timMock
,
_beginRemoveRows
));
Fake
(
Method
(
timMock
,
_endInsertRows
));
...
...
@@ -1894,7 +1886,6 @@ TEST_CASE("Operations under locked tracks", "[Locked]")
REQUIRE
(
timeline
->
requestTrackInsertion
(
-
1
,
tid2
));
REQUIRE
(
timeline
->
requestTrackInsertion
(
-
1
,
tid3
));
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
3
_Times
);
RESET
(
timMock
);
SECTION
(
"Locked track can't receive insertion"
)
...
...
tests/test_utils.hpp
View file @
0a053c1f
...
...
@@ -41,8 +41,7 @@
using
namespace
fakeit
;
#define RESET(mock) \
mock.Reset(); \
Fake(Method(mock, adjustAssetRange)); \
Spy(Method(mock, _resetView)); \
Fake(Method(mock, adjustAssetRange)); \
Spy(Method(mock, _beginInsertRows)); \
Spy(Method(mock, _beginRemoveRows)); \
Spy(Method(mock, _endInsertRows)); \
...
...
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