Commit 1347aa72 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

tests: Device: Add an unmounted device test

parent d2069c0f
......@@ -109,3 +109,32 @@ TEST_F( Devices, RemoveDisk )
file = ml->file( std::string( mock::FileSystemFactory::SubFolder ) + "subfile.mp4" );
ASSERT_EQ( nullptr, file );
}
TEST_F( Devices, UnmountDisk )
{
cbMock->prepareForWait( 1 );
ml->discover( "." );
bool discovered = cbMock->wait();
ASSERT_TRUE( discovered );
auto files = ml->files();
ASSERT_EQ( 3u, files.size() );
auto file = ml->file( std::string( mock::FileSystemFactory::SubFolder ) + "subfile.mp4" );
ASSERT_NE( nullptr, file );
auto subdir = fsMock->directory( mock::FileSystemFactory::SubFolder );
auto device = std::static_pointer_cast<mock::Device>( subdir->device() );
device->setPresent( false );
cbMock->prepareForReload();
Reload();
bool reloaded = cbMock->waitForReload();
ASSERT_TRUE( reloaded );
files = ml->files();
ASSERT_EQ( 2u, files.size() );
file = ml->file( std::string( mock::FileSystemFactory::SubFolder ) + "subfile.mp4" );
ASSERT_EQ( nullptr, file );
}
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