Update library backend tests
This commit is contained in:
parent
45f5219cde
commit
fd2da463b1
@ -135,16 +135,16 @@ TEST_F(LibraryBackendTest, EmptyDatabase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LibraryBackendTest, AddDirectory) {
|
TEST_F(LibraryBackendTest, AddDirectory) {
|
||||||
QSignalSpy spy(backend_.get(), SIGNAL(DirectoriesDiscovered(DirectoryList)));
|
QSignalSpy spy(backend_.get(), SIGNAL(DirectoryDiscovered(Directory, SubdirectoryList)));
|
||||||
|
|
||||||
backend_->AddDirectory("/test");
|
backend_->AddDirectory("/test");
|
||||||
|
|
||||||
// Check the signal was emitted correctly
|
// Check the signal was emitted correctly
|
||||||
ASSERT_EQ(1, spy.count());
|
ASSERT_EQ(1, spy.count());
|
||||||
DirectoryList list = spy[0][0].value<DirectoryList>();
|
Directory dir = spy[0][0].value<Directory>();
|
||||||
ASSERT_EQ(1, list.size());
|
EXPECT_EQ("/test", dir.path);
|
||||||
EXPECT_EQ("/test", list[0].path);
|
EXPECT_EQ(1, dir.id);
|
||||||
EXPECT_EQ(1, list[0].id);
|
EXPECT_EQ(0, spy[0][1].value<SubdirectoryList>().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LibraryBackendTest, RemoveDirectory) {
|
TEST_F(LibraryBackendTest, RemoveDirectory) {
|
||||||
@ -154,17 +154,16 @@ TEST_F(LibraryBackendTest, RemoveDirectory) {
|
|||||||
dir.path = "/test";
|
dir.path = "/test";
|
||||||
backend_->AddDirectory(dir.path);
|
backend_->AddDirectory(dir.path);
|
||||||
|
|
||||||
QSignalSpy spy(backend_.get(), SIGNAL(DirectoriesDeleted(DirectoryList)));
|
QSignalSpy spy(backend_.get(), SIGNAL(DirectoryDeleted(Directory)));
|
||||||
|
|
||||||
// Remove the directory again
|
// Remove the directory again
|
||||||
backend_->RemoveDirectory(dir);
|
backend_->RemoveDirectory(dir);
|
||||||
|
|
||||||
// Check the signal was emitted correctly
|
// Check the signal was emitted correctly
|
||||||
ASSERT_EQ(1, spy.count());
|
ASSERT_EQ(1, spy.count());
|
||||||
DirectoryList list = spy[0][0].value<DirectoryList>();
|
dir = spy[0][0].value<Directory>();
|
||||||
ASSERT_EQ(1, list.size());
|
EXPECT_EQ("/test", dir.path);
|
||||||
EXPECT_EQ("/test", list[0].path);
|
EXPECT_EQ(1, dir.id);
|
||||||
EXPECT_EQ(1, list[0].id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LibraryBackendTest, AddInvalidSong) {
|
TEST_F(LibraryBackendTest, AddInvalidSong) {
|
||||||
|
@ -28,7 +28,10 @@
|
|||||||
class MetatypesEnvironment : public ::testing::Environment {
|
class MetatypesEnvironment : public ::testing::Environment {
|
||||||
public:
|
public:
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
|
qRegisterMetaType<Directory>("Directory");
|
||||||
qRegisterMetaType<DirectoryList>("DirectoryList");
|
qRegisterMetaType<DirectoryList>("DirectoryList");
|
||||||
|
qRegisterMetaType<Subdirectory>("Subdirectory");
|
||||||
|
qRegisterMetaType<SubdirectoryList>("SubdirectoryList");
|
||||||
qRegisterMetaType<SongList>("SongList");
|
qRegisterMetaType<SongList>("SongList");
|
||||||
qRegisterMetaType<QModelIndex>("QModelIndex");
|
qRegisterMetaType<QModelIndex>("QModelIndex");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user