Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
d5e8b315
Commit
d5e8b315
authored
Dec 23, 2015
by
Hugo Beauzée-Luyssen
Browse files
tests: Add a partial album tracks removal test
parent
c35a09a0
Changes
1
Show whitespace changes
Inline
Side-by-side
test/unittest/DeviceTests.cpp
View file @
d5e8b315
...
...
@@ -25,6 +25,7 @@
#include "Album.h"
#include "Device.h"
#include "Media.h"
#include "Artist.h"
#include "mocks/FileSystem.h"
#include "mocks/DiscovererCbMock.h"
...
...
@@ -271,3 +272,43 @@ TEST_F( DeviceFs, RemoveAlbum )
artists
=
ml
->
artists
();
ASSERT_EQ
(
1u
,
artists
.
size
()
);
}
TEST_F
(
DeviceFs
,
PartialAlbumRemoval
)
{
cbMock
->
prepareForWait
(
1
);
ml
->
discover
(
mock
::
FileSystemFactory
::
Root
);
bool
discovered
=
cbMock
->
wait
();
ASSERT_TRUE
(
discovered
);
{
auto
album
=
std
::
static_pointer_cast
<
Album
>
(
ml
->
createAlbum
(
"album"
)
);
auto
file
=
ml
->
file
(
mock
::
FileSystemFactory
::
SubFolder
+
"/subfile.mp4"
);
auto
file2
=
ml
->
file
(
RemovableDeviceMountpoint
+
"/removablefile2.mp3"
);
album
->
addTrack
(
std
::
static_pointer_cast
<
Media
>
(
file
),
1
,
1
);
album
->
addTrack
(
std
::
static_pointer_cast
<
Media
>
(
file2
),
2
,
1
);
auto
newArtist
=
ml
->
createArtist
(
"artist"
);
album
->
setAlbumArtist
(
newArtist
.
get
()
);
newArtist
->
addMedia
(
static_cast
<
Media
*>
(
file
.
get
()
)
);
newArtist
->
addMedia
(
static_cast
<
Media
*>
(
file2
.
get
()
)
);
}
auto
albums
=
ml
->
albums
();
ASSERT_EQ
(
1u
,
albums
.
size
()
);
auto
artists
=
ml
->
artists
();
ASSERT_EQ
(
1u
,
artists
.
size
()
);
auto
artist
=
artists
[
0
];
ASSERT_EQ
(
2u
,
artist
->
media
().
size
()
);
fsMock
->
removeDevice
(
RemovableDeviceUuid
);
cbMock
->
prepareForReload
();
Reload
();
bool
reloaded
=
cbMock
->
waitForReload
();
ASSERT_TRUE
(
reloaded
);
albums
=
ml
->
albums
();
ASSERT_EQ
(
1u
,
albums
.
size
()
);
artists
=
ml
->
artists
();
ASSERT_EQ
(
1u
,
artists
.
size
()
);
ASSERT_EQ
(
1u
,
albums
[
0
]
->
tracks
().
size
()
);
ASSERT_EQ
(
1u
,
artists
[
0
]
->
media
().
size
()
);
}
Write
Preview
Markdown
is supported
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