Commit 3c0e6f1f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

unittest: Add a way to count triggers for migration tests

parent 2e69d27f
......@@ -185,3 +185,8 @@ void MediaLibraryTester::addDiscoveredFile(std::shared_ptr<fs::IFile> fileFs,
{
addFile( fileFs, parentFolder, parentFolderFs );
}
sqlite::Connection* MediaLibraryTester::getDbConn()
{
return m_dbConnection.get();
}
......@@ -71,6 +71,7 @@ public:
std::shared_ptr<Folder> parentFolder,
std::shared_ptr<fs::IDirectory> parentFolderFs,
std::pair<std::shared_ptr<Playlist>, unsigned int> parentPlaylist ) override;
sqlite::Connection* getDbConn();
private:
std::shared_ptr<fs::IDirectory> dummyDirectory;
......
......@@ -92,6 +92,17 @@ public:
}
}
void CheckNbTriggers( uint32_t expected )
{
medialibrary::sqlite::Statement stmt{ ml->getDbConn()->handle(),
"SELECT COUNT(*) FROM sqlite_master WHERE type='trigger'" };
stmt.execute();
auto row = stmt.row();
uint32_t nbTriggers;
row >> nbTriggers;
ASSERT_EQ( nbTriggers, expected );
}
virtual void TearDown() override
{
medialibrary::sqlite::Connection::Handle conn;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment