1 /* 2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 ** Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "FormatDescriptions.h" 8 9 #include <MediaFormats.h> 10 11 #include <cppunit/TestCaller.h> 12 #include <cppunit/TestSuite.h> 13 14 15 FormatDescriptionsTest::FormatDescriptionsTest() 16 { 17 } 18 19 20 FormatDescriptionsTest::~FormatDescriptionsTest() 21 { 22 } 23 24 25 void 26 FormatDescriptionsTest::TestCompare() 27 { 28 media_format_description a; 29 a.family = B_AVI_FORMAT_FAMILY; 30 a.u.avi.codec = 'DIVX'; 31 32 media_format_description b; 33 CPPUNIT_ASSERT(!(a == b)); 34 35 b.family = a.family; 36 CPPUNIT_ASSERT(!(a == b)); 37 38 a.family = B_QUICKTIME_FORMAT_FAMILY; 39 a.u.quicktime.vendor = 5; 40 a.u.quicktime.codec = 5; 41 42 b.family = B_QUICKTIME_FORMAT_FAMILY; 43 b.u.quicktime.vendor = 6; 44 b.u.quicktime.codec = 5; 45 CPPUNIT_ASSERT(a < b); 46 47 b.u.quicktime.vendor = 4; 48 CPPUNIT_ASSERT(b < a); 49 50 b.u.quicktime.vendor = 5; 51 b.u.quicktime.codec = 6; 52 CPPUNIT_ASSERT(a < b); 53 54 b.u.quicktime.codec = 4; 55 CPPUNIT_ASSERT(b < a); 56 57 a.family = B_MISC_FORMAT_FAMILY; 58 a.u.misc.file_format = 5; 59 a.u.misc.codec = 5; 60 61 b.family = B_MISC_FORMAT_FAMILY; 62 b.u.misc.file_format = 6; 63 b.u.misc.codec = 5; 64 CPPUNIT_ASSERT(a < b); 65 66 b.u.misc.file_format = 4; 67 CPPUNIT_ASSERT(b < a); 68 69 70 b.u.misc.file_format = 5; 71 b.u.misc.codec = 6; 72 CPPUNIT_ASSERT(a < b); 73 74 b.u.misc.codec = 4; 75 CPPUNIT_ASSERT(b < a); 76 } 77 78 79 /*static*/ void 80 FormatDescriptionsTest::AddTests(BTestSuite& parent) 81 { 82 CppUnit::TestSuite& suite = *new CppUnit::TestSuite("FormatDescriptionsTest"); 83 84 suite.addTest(new CppUnit::TestCaller<FormatDescriptionsTest>( 85 "FormatDescriptionsTest::TestCompare", 86 &FormatDescriptionsTest::TestCompare)); 87 88 parent.addTest("FormatDescriptionsTest", &suite); 89 } 90