mirror of
				https://github.com/taglib/taglib.git
				synced 2025-11-03 16:26:18 -05:00 
			
		
		
		
	Merge pull request #608 from TsudaKageyu/mp4-has-tags
Add a method to check if an MP4 file on disk actually has a tag.
This commit is contained in:
		@ -19,6 +19,7 @@ class TestMP4 : public CppUnit::TestFixture
 | 
			
		||||
  CPPUNIT_TEST(testPropertiesALAC);
 | 
			
		||||
  CPPUNIT_TEST(testFreeForm);
 | 
			
		||||
  CPPUNIT_TEST(testCheckValid);
 | 
			
		||||
  CPPUNIT_TEST(testHasTag);
 | 
			
		||||
  CPPUNIT_TEST(testIsEmpty);
 | 
			
		||||
  CPPUNIT_TEST(testUpdateStco);
 | 
			
		||||
  CPPUNIT_TEST(testSaveExisingWhenIlstIsLast);
 | 
			
		||||
@ -67,8 +68,30 @@ public:
 | 
			
		||||
  {
 | 
			
		||||
    MP4::File f(TEST_FILE_PATH_C("empty.aiff"));
 | 
			
		||||
    CPPUNIT_ASSERT(!f.isValid());
 | 
			
		||||
    MP4::File f2(TEST_FILE_PATH_C("has-tags.m4a"));
 | 
			
		||||
    CPPUNIT_ASSERT(f2.isValid());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void testHasTag()
 | 
			
		||||
  {
 | 
			
		||||
    {
 | 
			
		||||
      MP4::File f(TEST_FILE_PATH_C("has-tags.m4a"));
 | 
			
		||||
      CPPUNIT_ASSERT(f.isValid());
 | 
			
		||||
      CPPUNIT_ASSERT(f.hasMP4Tag());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ScopedFileCopy copy("no-tags", ".m4a");
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
      MP4::File f(copy.fileName().c_str());
 | 
			
		||||
      CPPUNIT_ASSERT(f.isValid());
 | 
			
		||||
      CPPUNIT_ASSERT(!f.hasMP4Tag());
 | 
			
		||||
      f.tag()->setTitle("TITLE");
 | 
			
		||||
      f.save();
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
      MP4::File f(copy.fileName().c_str());
 | 
			
		||||
      CPPUNIT_ASSERT(f.isValid());
 | 
			
		||||
      CPPUNIT_ASSERT(f.hasMP4Tag());
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void testIsEmpty()
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user