]> granicus.if.org Git - taglib/commitdiff
Added a test for APE::Item
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 14 Jul 2013 02:22:15 +0000 (11:22 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 14 Jul 2013 02:35:10 +0000 (11:35 +0900)
tests/test_apetag.cpp

index c93b2a7ebe1a9ce6d32dff5bb8235ca4601ab8a4..845828f56f75e727c7404468355e42559a5c0d66 100644 (file)
@@ -20,6 +20,7 @@ class TestAPETag : public CppUnit::TestFixture
   CPPUNIT_TEST(testPropertyInterface1);
   CPPUNIT_TEST(testPropertyInterface2);
   CPPUNIT_TEST(testInvalidKeys);
+  CPPUNIT_TEST(testTextBinary);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -97,6 +98,23 @@ public:
     CPPUNIT_ASSERT(unsuccessful.contains("A"));
     CPPUNIT_ASSERT(unsuccessful.contains("MP+"));
   }
+  
+  void testTextBinary()
+  {
+    APE::Item item = APE::Item("DUMMY", "Test Text");
+    CPPUNIT_ASSERT_EQUAL(String("Test Text"), item.toString());
+    CPPUNIT_ASSERT_EQUAL(ByteVector::null, item.binaryData());
+    
+    ByteVector data("Test Data");
+    item.setBinaryData(data);
+    CPPUNIT_ASSERT(item.values().isEmpty());
+    CPPUNIT_ASSERT_EQUAL(String::null, item.toString());
+    CPPUNIT_ASSERT_EQUAL(data, item.binaryData());
+    
+    item.setValue("Test Text 2");
+    CPPUNIT_ASSERT_EQUAL(String("Test Text 2"), item.toString());
+    CPPUNIT_ASSERT_EQUAL(ByteVector::null, item.binaryData());
+  }
 
 };