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
487ce84f
Commit
487ce84f
authored
Jun 21, 2019
by
Jean-Baptiste Mardelle
Browse files
Fix tests
parent
c97b7fdf
Pipeline
#4491
passed with stage
in 16 minutes and 13 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/clipmodel.cpp
View file @
487ce84f
...
...
@@ -204,7 +204,7 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
if
(
m_currentTrackId
>
-
1
)
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeClipIndexFromID
(
m_id
);
ptr
->
data
Change
d
(
ix
,
ix
,
roles
);
ptr
->
notify
Change
(
ix
,
ix
,
roles
);
}
}
return
true
;
...
...
@@ -224,7 +224,7 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
if
(
m_currentTrackId
>
-
1
)
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeClipIndexFromID
(
m_id
);
ptr
->
data
Change
d
(
ix
,
ix
,
roles
);
ptr
->
notify
Change
(
ix
,
ix
,
roles
);
}
}
return
true
;
...
...
src/timeline2/model/compositionmodel.cpp
View file @
487ce84f
...
...
@@ -123,9 +123,11 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
Fun
operation
=
[
this
,
track_operation
,
roles
]()
{
if
(
track_operation
())
{
// we send a list of roles to be updated
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeCompositionIndexFromID
(
m_id
);
ptr
->
dataChanged
(
ix
,
ix
,
roles
);
if
(
m_currentTrackId
!=
-
1
)
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeCompositionIndexFromID
(
m_id
);
ptr
->
notifyChange
(
ix
,
ix
,
roles
);
}
}
return
true
;
}
...
...
@@ -140,9 +142,11 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
}
Fun
reverse
=
[
this
,
track_reverse
,
roles
]()
{
if
(
track_reverse
())
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeCompositionIndexFromID
(
m_id
);
ptr
->
dataChanged
(
ix
,
ix
,
roles
);
if
(
m_currentTrackId
!=
-
1
)
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeCompositionIndexFromID
(
m_id
);
ptr
->
notifyChange
(
ix
,
ix
,
roles
);
}
}
return
true
;
}
...
...
src/timeline2/model/timelinemodel.cpp
View file @
487ce84f
...
...
@@ -3365,3 +3365,4 @@ std::unordered_set<int> TimelineModel::getAllTracksIds() const
std
::
transform
(
m_iteratorTable
.
begin
(),
m_iteratorTable
.
end
(),
std
::
inserter
(
result
,
result
.
begin
()),
[
&
](
const
auto
&
track
)
{
return
track
.
first
;
});
return
result
;
}
tests/modeltest.cpp
View file @
487ce84f
...
...
@@ -84,10 +84,11 @@ TEST_CASE("Basic creation/deletion of a track", "[TrackModel]")
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
RESET
(
timMock
);
REQUIRE
(
timeline
->
requestTrackDeletion
(
id2
));
// We are not allowed to delete the last track
REQUIRE_FALSE
(
timeline
->
requestTrackDeletion
(
id2
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getTracksCount
()
==
0
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
Once
);
REQUIRE
(
timeline
->
getTracksCount
()
==
1
);
Verify
(
Method
(
timMock
,
_resetView
)).
Exactly
(
0
);
RESET
(
timMock
);
SECTION
(
"Delete a track with groups"
)
...
...
@@ -106,7 +107,7 @@ TEST_CASE("Basic creation/deletion of a track", "[TrackModel]")
REQUIRE
(
timeline
->
requestClipInsertion
(
binId
,
tid2
,
2
*
length
,
cid4
));
REQUIRE
(
timeline
->
checkConsistency
());
REQUIRE
(
timeline
->
getClipsCount
()
==
4
);
REQUIRE
(
timeline
->
getTracksCount
()
==
2
);
REQUIRE
(
timeline
->
getTracksCount
()
==
3
);
auto
g1
=
std
::
unordered_set
<
int
>
({
cid1
,
cid3
});
auto
g2
=
std
::
unordered_set
<
int
>
({
cid2
,
cid4
});
...
...
@@ -118,7 +119,7 @@ TEST_CASE("Basic creation/deletion of a track", "[TrackModel]")
REQUIRE
(
timeline
->
requestTrackDeletion
(
tid1
));
REQUIRE
(
timeline
->
getClipsCount
()
==
3
);
REQUIRE
(
timeline
->
getTracksCount
()
==
1
);
REQUIRE
(
timeline
->
getTracksCount
()
==
2
);
REQUIRE
(
timeline
->
checkConsistency
());
}
binModel
->
clean
();
...
...
@@ -2070,6 +2071,7 @@ TEST_CASE("Operations under locked tracks", "[Locked]")
REQUIRE
(
timeline
->
requestItemResize
(
compo
,
17
,
true
)
==
17
);
check
(
17
);
}
binModel
->
clean
();
pCore
->
m_projectManager
=
nullptr
;
Logger
::
print_trace
();
...
...
tests/regressions.cpp
View file @
487ce84f
...
...
@@ -463,7 +463,8 @@ TEST_CASE("FuzzBug1")
REQUIRE
(
timeline_0
->
checkConsistency
());
{
bool
res
=
timeline_0
->
requestTrackDeletion
(
1
);
REQUIRE
(
res
==
true
);
// Cannot delete last track
REQUIRE
(
res
==
false
);
}
REQUIRE
(
timeline_0
->
checkConsistency
());
undoStack
->
undo
();
...
...
tests/test_utils.hpp
View file @
487ce84f
...
...
@@ -39,7 +39,7 @@
#include "transitions/transitionsrepository.hpp"
using
namespace
fakeit
;
#define RESET(mock)
\
#define RESET(mock) \
mock.Reset(); \
Fake(Method(mock, adjustAssetRange)); \
Spy(Method(mock, _resetView)); \
...
...
@@ -56,8 +56,8 @@ using namespace fakeit;
VerifyNoOtherInvocations(Method(timMock, _beginInsertRows)); \
VerifyNoOtherInvocations(Method(timMock, _endRemoveRows)); \
VerifyNoOtherInvocations(Method(timMock, _endInsertRows)); \
VerifyNoOtherInvocations(OverloadedMethod(timMock, notifyChange, void(const QModelIndex &, const QModelIndex &, bool, bool, bool)));
\
VerifyNoOtherInvocations(OverloadedMethod(timMock, notifyChange, void(const QModelIndex &, const QModelIndex &, const QVector<int> &))); \
VerifyNoOtherInvocations(OverloadedMethod(timMock, notifyChange, void(const QModelIndex &, const QModelIndex &, bool, bool, bool))); \
VerifyNoOtherInvocations(OverloadedMethod(timMock, notifyChange, void(const QModelIndex &, const QModelIndex &, const QVector<int> &)));
\
RESET(timMock);
#define CHECK_MOVE(times) \
...
...
@@ -74,7 +74,7 @@ using namespace fakeit;
NO_OTHERS();
#define CHECK_RESIZE(times) \
Verify(OverloadedMethod(timMock, notifyChange, void(const QModelIndex &, const QModelIndex &,
bool, bool, bool))).Exactly(times);
\
Verify(OverloadedMethod(timMock, notifyChange, void(const QModelIndex &, const QModelIndex &,
const QVector<int> &))).Exactly(times);
\
NO_OTHERS();
#define CHECK_UPDATE(role) \
...
...
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