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

unittest: Add a way to count triggers for migration tests

parent c09ff6df
......@@ -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;
......
......@@ -93,6 +93,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;
......@@ -177,4 +188,6 @@ TEST_F( DbModel, Upgrade13to14 )
m = media[1];
ASSERT_EQ( m->thumbnail(), "" );
ASSERT_FALSE( m->isThumbnailGenerated() );
CheckNbTriggers( 31 );
}
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