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

Media: Fix inverted logic

parent 3ad0797f
......@@ -416,7 +416,7 @@ IMedia::SubType Media::subType() const
void Media::setType( Type type )
{
if ( m_type != type )
if ( m_type == type )
return;
m_type = type;
m_changed = true;
......
......@@ -411,6 +411,21 @@ TEST_F( Medias, SortByFileSize )
ASSERT_EQ( m1->id(), media[0]->id() );
}
TEST_F( Medias, SetType )
{
auto m1 = ml->addFile( "media1.mp3" );
ASSERT_EQ( IMedia::Type::AudioType, m1->type() );
m1->setType( IMedia::Type::VideoType );
m1->save();
ASSERT_EQ( IMedia::Type::VideoType, m1->type() );
Reload();
auto m2 = ml->media( m1->id() );
ASSERT_EQ( IMedia::Type::VideoType, m2->type() );
}
class FetchMedia : public Tests
{
......
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