Esempio n. 1
0
static HRESULT ReadRecord (const aafWChar * pFileName, int loadingMode)
{
  HRESULT hr = E_FAIL;
  IAAFFileSP   pFile;

  try 
	{
	  // Open the file, and get the dictionary.
	  checkResult(AAFFileOpenExistingRead(pFileName, loadingMode, &pFile));
	  IAAFHeaderSP pHeader;
	  checkResult(pFile->GetHeader(&pHeader));
	  IAAFDictionarySP pDict;
	  checkResult (pHeader->GetDictionary(&pDict));
	  CAAFBuiltinDefs defs(pDict);

	  // get the SDK version against which we are testing
	  aafProductVersion_t			testVer;
	  checkResult(pHeader->GetRefImplVersion(&testVer));

	  // Get the type definitions for our new types.
	  IAAFTypeDefSP ptd;
	  checkResult (pDict->LookupTypeDef (sTypeId_Rational16,
										 &ptd));
	  IAAFTypeDefRecordSP ptdr16;
	  checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord,
										(void**) &ptdr16));

	  // check for duplicate initialization
	  aafUID_t nullUid = { 0 };
	  HRESULT temphr;
	  temphr = ptdr16->Initialize (nullUid,
								  0,
								  0,
								  1,
								  L"foo");
	  checkExpression (AAFRESULT_ALREADY_INITIALIZED == temphr,
					   AAFRESULT_TEST_FAILED);

	  aafUInt32 count = 0;
	  checkResult (ptdr16->GetCount (&count));
	  checkExpression (2 == count, AAFRESULT_TEST_FAILED);

	  aafUInt32  nameLen = 0;
	  aafCharacter nameBuf [100];
	  checkResult (ptdr16->GetMemberNameBufLen (0, &nameLen));
	  checkExpression (((wcslen(L"Numerator")+1)*sizeof(aafCharacter))
					   == nameLen,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (nameLen < 100,
					   AAFRESULT_TEST_FAILED);
	  checkResult (ptdr16->GetMemberName (0,
										 nameBuf,
										 sizeof (nameBuf)));
	  checkExpression (0 == wcscmp (L"Numerator", nameBuf),
					   AAFRESULT_TEST_FAILED);

	  checkResult (ptdr16->GetMemberNameBufLen (1, &nameLen));
	  checkExpression (((wcslen(L"Denominator")+1)*sizeof (aafCharacter))
					   == nameLen,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (nameLen < 100,
					   AAFRESULT_TEST_FAILED);
	  checkResult (ptdr16->GetMemberName (1,
										 nameBuf,
										 sizeof (nameBuf)));
	  checkExpression (0 == wcscmp (L"Denominator", nameBuf),
					   AAFRESULT_TEST_FAILED);

	  temphr = ptdr16->GetMemberNameBufLen (2, &nameLen);
	  checkExpression (AAFRESULT_ILLEGAL_VALUE == temphr,
					   AAFRESULT_TEST_FAILED);

	  temphr = ptdr16->GetMemberName (2,
									 nameBuf,
									 sizeof (nameBuf));
	  checkExpression (AAFRESULT_ILLEGAL_VALUE == temphr,
					   AAFRESULT_TEST_FAILED);

	  checkResult (pDict->LookupTypeDef (sTypeId_Rational16_pair,
										 &ptd));
	  IAAFTypeDefRecordSP ptdr16p;
	  checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord,
										(void**) &ptdr16p));

	  // check for duplicate initialization
	  temphr = ptdr16p->Initialize (nullUid,
								   0,
								   0,
								   1,
								   L"foo");
	  checkExpression (AAFRESULT_ALREADY_INITIALIZED == temphr,
					   AAFRESULT_TEST_FAILED);

	  count = 0;
	  checkResult (ptdr16p->GetCount (&count));
	  checkExpression (2 == count, AAFRESULT_TEST_FAILED);

	  // Now attempt to register offsets of Rational16_pair.  This
	  // should fail, because offsets of its members (of type
	  // Rational16) have not yet been registered.
	  temphr = RegisterRational16PairOffsets (ptdr16p);
	  checkExpression (temphr == AAFRESULT_NOT_REGISTERED,
					   AAFRESULT_TEST_FAILED);

	  // Now let's attempt registration the right way.
	  checkResult (RegisterRational16Offsets (ptdr16));
	  checkResult (RegisterRational16PairOffsets (ptdr16p));
		
	  // Setup to read the Velocity property which is of typed Mixed_t
	  checkResult (pDict->LookupTypeDef (sTypeId_Mixed, &ptd));
	  IAAFTypeDefRecordSP ptdrmixed;
	  checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord, (void**) &ptdrmixed));
	  temphr = RegisterMixedOffsets(ptdrmixed);
	  /* It is ok to return default already used due to current limitation
           * in implementation that default registration may occur and tie us
           * to a specific structural layout before we get the ability to
           * register own offsets/layout. This is slated for fixing in
           * future rev of the SDK.
           */
	  if (temphr == AAFRESULT_DEFAULT_ALREADY_USED) {
	      temphr = AAFRESULT_SUCCESS;
	      throw temphr;
	  }

	  checkResult (temphr);

	  IAAFTypeDef * pTempTd = 0;
	  checkResult (ptdr16->QueryInterface (IID_IAAFTypeDef,
										(void**) &pTempTd));
	  CheckMemberTypeEqual (ptdr16p, 0, pTempTd);
	  CheckMemberTypeEqual (ptdr16p, 1, pTempTd);
	  pTempTd->Release ();
	  pTempTd = 0;

	  temphr = ptdr16p->GetMemberType (2, &pTempTd);
	  checkExpression (temphr == AAFRESULT_ILLEGAL_VALUE,
					   AAFRESULT_TEST_FAILED);

	  // register variable array of Rational16Pair records
	  IAAFTypeDefVariableArraySP ptdvaarpr;
	  IAAFTypeDefSP ptdarpr;
	  // perform this part only for specified versions
	  if( versionUInt(testVer) >= versionUInt(1,1,1,0) )
	  {
		checkResult (pDict->LookupTypeDef (sTypeId_Rational16_array,&ptdarpr));
		checkResult (ptdarpr->QueryInterface (IID_IAAFTypeDefVariableArray,(void**) &ptdvaarpr));
	  }

	  // Now read the CompositionMob to which we added some optional
	  // properties.
	  IEnumAAFMobsSP pEnumMobs;
	  checkResult (pHeader->GetMobs (0, &pEnumMobs));

	  IAAFMobSP pMob;
	  checkResult (pEnumMobs->NextOne (&pMob));
	  IAAFObjectSP pObj;
	  checkResult (pMob->QueryInterface (IID_IAAFObject,
										 (void**) &pObj));

	  // get the property definitions for the added properties
	  IAAFPropertyDefSP pPdPosA;
	  checkResult (defs.cdCompositionMob()->
				   LookupPropertyDef (sPropertyId_positionA,
									  &pPdPosA));
	  IAAFPropertyDefSP pPdPosB;
	  checkResult (defs.cdCompositionMob()->
				   LookupPropertyDef (sPropertyId_positionB,
									  &pPdPosB));
	  IAAFPropertyDefSP pPdPosC;
	  checkResult (defs.cdCompositionMob()->
				   LookupPropertyDef (sPropertyId_positionC,
									  &pPdPosC));

	  IAAFPropertyValueSP pPVa;
	  checkResult (pObj->GetPropertyValue (pPdPosA, &pPVa));
	  IAAFPropertyValueSP pPVb;
	  checkResult (pObj->GetPropertyValue (pPdPosB, &pPVb));
	  IAAFPropertyValueSP pPVc;
	  checkResult (pObj->GetPropertyValue (pPdPosC, &pPVc));

	  // Read back the value of the Velocity property
	  IAAFPropertyDefSP pPdvelocity;
	  checkResult (defs.cdCompositionMob()->LookupPropertyDef(sPropertyId_velocity, &pPdvelocity));
	  IAAFPropertyValueSP pPVvelocity;
	  checkResult (pObj->GetPropertyValue (pPdvelocity, &pPVvelocity));
	  Mixed_t velocity = {0, 0};
	  checkResult (ptdrmixed->GetStruct (pPVvelocity, (aafMemPtr_t) &velocity, sizeof (velocity)));
	  checkExpression (15 == velocity.angle, AAFRESULT_TEST_FAILED);
	  checkExpression (2001 == velocity.speed, AAFRESULT_TEST_FAILED);

	  // Try to read the first one with GetStruct.
	  Rational16pair_t valA = { {0,0},{0,0} };
	  checkResult (ptdr16p->GetStruct (pPVa,
									  (aafMemPtr_t) &valA,
									  sizeof (valA)));
	  checkExpression (1 == valA.X_Position.Numerator,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (2 == valA.X_Position.Denominator,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (3 == valA.Y_Position.Numerator,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (4 == valA.Y_Position.Denominator,
					   AAFRESULT_TEST_FAILED);

	  // Try to read the second one by decomposing with GetValue.
	  Rational16pair_t valB = { {5, 6}, {7, 8} };
	  CheckRational16PairByValues (ptdr16p, ptdr16, pPVb, valB);

	  // Read the last two with GetStruct just to get it over with. ;)
	  Rational16pair_t valC = { {0,0},{0,0} };
	  temphr = ptdr16p->GetStruct (pPVc,
								  (aafMemPtr_t) &valC,
								  sizeof (valC)-1);
	  checkExpression (AAFRESULT_ILLEGAL_VALUE == temphr,
					   AAFRESULT_TEST_FAILED);
	  temphr = ptdr16p->GetStruct (0,
								  (aafMemPtr_t) &valC,
								  sizeof (valC));
	  checkExpression (AAFRESULT_NULL_PARAM == temphr,
					   AAFRESULT_TEST_FAILED);
	  temphr = ptdr16p->GetStruct (pPVc,
								  0,
								  sizeof (valC));
	  checkExpression (AAFRESULT_NULL_PARAM == temphr,
					   AAFRESULT_TEST_FAILED);
	  checkResult (ptdr16p->GetStruct (pPVc,
									  (aafMemPtr_t) &valC,
									  sizeof (valC)));
	  checkExpression (9 == valC.X_Position.Numerator,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (10 == valC.X_Position.Denominator,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (11 == valC.Y_Position.Numerator,
					   AAFRESULT_TEST_FAILED);
	  checkExpression (12 == valC.Y_Position.Denominator,
					   AAFRESULT_TEST_FAILED);

	  // test variable array of records
	  // perform this part only for specified versions
	  if( versionUInt(testVer) >= versionUInt(1,1,1,0) )
	  {
		IAAFPropertyDefSP pPdPosN;
		checkResult (defs.cdCompositionMob()->LookupPropertyDef (sPropertyId_positionN,	&pPdPosN));
		IAAFPropertyValueSP pPVN;
		checkResult (pObj->GetPropertyValue (pPdPosN, &pPVN));

		// get the middle element of the array, 9abc
		IAAFPropertyValueSP pPVN1;
		checkResult (ptdvaarpr->GetElementValue (pPVN, 1, &pPVN1));

		// Read the value with GetStruct
		Rational16pair_t valN1 = { {0,0},{0,0} };
		checkResult (ptdr16p->GetStruct (pPVN1,
										(aafMemPtr_t) &valN1,
										sizeof (valN1)));
		checkExpression (9 == valN1.X_Position.Numerator,
						AAFRESULT_TEST_FAILED);
		checkExpression (10 == valN1.X_Position.Denominator,
						AAFRESULT_TEST_FAILED);
		checkExpression (11 == valN1.Y_Position.Numerator,
						AAFRESULT_TEST_FAILED);
		checkExpression (12 == valN1.Y_Position.Denominator,
						AAFRESULT_TEST_FAILED);
	  }

	  // Attempt to close the file.
	  checkResult(pFile->Close());
	  IAAFFileSP nullFile;
	  pFile = nullFile;  // zeros the pFile, and releases it.

	  hr = AAFRESULT_SUCCESS;
	}
  catch (HRESULT& rResult)
	{
	  hr = rResult;
	}
	
  // cleanup
  if (pFile)
	{
	  pFile->Close();
	}
	
  return hr;
}
Esempio n. 2
0
static HRESULT ReadRecordNoStructs (const aafWChar * pFileName, int loadingMode)
{
  HRESULT hr = E_FAIL;
  HRESULT temphr;
  IAAFFileSP   pFile;

  try 
	{
	  // Open the file, and get the dictionary.
	  checkResult(AAFFileOpenExistingRead(pFileName, loadingMode, &pFile));
	  IAAFHeaderSP pHeader;
	  checkResult(pFile->GetHeader(&pHeader));
	  IAAFDictionarySP pDict;
	  checkResult (pHeader->GetDictionary(&pDict));
	  CAAFBuiltinDefs defs(pDict);

	  // get the SDK version against which we are testing
	  aafProductVersion_t			testVer;
	  checkResult(pHeader->GetRefImplVersion(&testVer));

	  // Get the type definitions for our new types.
	  IAAFTypeDefSP ptd;
	  checkResult (pDict->LookupTypeDef (sTypeId_Rational16,
										 &ptd));
	  IAAFTypeDefRecordSP ptdr16;
	  checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord,
										(void**) &ptdr16));

	  checkResult (pDict->LookupTypeDef (sTypeId_Rational16_pair,
										 &ptd));
	  IAAFTypeDefRecordSP ptdr16p;
	  checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord,
										(void**) &ptdr16p));

	  // Setup to read the Velocity property which is of typed Mixed_t
	  checkResult (pDict->LookupTypeDef (sTypeId_Mixed, &ptd));
	  IAAFTypeDefRecordSP ptdrmixed;
	  checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord, (void**) &ptdrmixed));

	  IAAFTypeDef * pTempTd = 0;
	  checkResult (ptdr16->QueryInterface (IID_IAAFTypeDef,
										(void**) &pTempTd));
	  CheckMemberTypeEqual (ptdr16p, 0, pTempTd);
          CheckMemberTypeEqual (ptdr16p, 1, pTempTd);
	  pTempTd->Release ();
	  pTempTd = 0;

	  temphr = ptdr16p->GetMemberType (2, &pTempTd);
	  checkExpression (temphr == AAFRESULT_ILLEGAL_VALUE,
					   AAFRESULT_TEST_FAILED);

	  // register variable array of Rational16Pair records
	  IAAFTypeDefVariableArraySP ptdvaarpr;
	  IAAFTypeDefSP ptdarpr;
	  // perform this part only for specified versions
	  if( versionUInt(testVer) >= versionUInt(1,1,1,0) )
	  {
		checkResult (pDict->LookupTypeDef (sTypeId_Rational16_array,&ptdarpr));
		checkResult (ptdarpr->QueryInterface (IID_IAAFTypeDefVariableArray,(void**) &ptdvaarpr));
	  }

	  // Now read the CompositionMob to which we added some optional
	  // properties.
	  IEnumAAFMobsSP pEnumMobs;
	  checkResult (pHeader->GetMobs (0, &pEnumMobs));

	  IAAFMobSP pMob;
	  checkResult (pEnumMobs->NextOne (&pMob));
	  IAAFObjectSP pObj;
	  checkResult (pMob->QueryInterface (IID_IAAFObject,
										 (void**) &pObj));

	  // get the property definitions for the added properties
	  IAAFPropertyDefSP pPdPosA;
	  checkResult (defs.cdCompositionMob()->
				   LookupPropertyDef (sPropertyId_positionA,
									  &pPdPosA));
	  IAAFPropertyDefSP pPdPosB;
	  checkResult (defs.cdCompositionMob()->
				   LookupPropertyDef (sPropertyId_positionB,
									  &pPdPosB));
	  IAAFPropertyDefSP pPdPosC;
	  checkResult (defs.cdCompositionMob()->
				   LookupPropertyDef (sPropertyId_positionC,
									  &pPdPosC));

	  IAAFPropertyValueSP pPVa;
	  checkResult (pObj->GetPropertyValue (pPdPosA, &pPVa));
	  IAAFPropertyValueSP pPVb;
	  checkResult (pObj->GetPropertyValue (pPdPosB, &pPVb));
	  IAAFPropertyValueSP pPVc;
	  checkResult (pObj->GetPropertyValue (pPdPosC, &pPVc));

	  // Read back the value of the Velocity property
	  IAAFPropertyDefSP pPdvelocity;
	  checkResult (defs.cdCompositionMob()->LookupPropertyDef(sPropertyId_velocity, &pPdvelocity));
	  IAAFPropertyValueSP pPVvelocity;
	  checkResult (pObj->GetPropertyValue (pPdvelocity, &pPVvelocity));

	  IAAFPropertyValueSP pPVvelocityAngle, pPVvelocitySpeed;
	  checkResult (ptdrmixed->GetValue (pPVvelocity, 0, &pPVvelocityAngle));
	  checkResult (ptdrmixed->GetValue (pPVvelocity, 1, &pPVvelocitySpeed));
      
	  Mixed_t velocity = {0, 0};
	  IAAFTypeDefSP pTDmem;
	  IAAFTypeDefIntSP pTDIntMem;
	  checkResult (ptdrmixed->GetMemberType (0, &pTDmem));
	  checkResult (pTDmem->QueryInterface (IID_IAAFTypeDefInt,
                                  (void **) &pTDIntMem));
	  checkResult (pTDIntMem->GetInteger (pPVvelocityAngle, 
                                   (aafMemPtr_t)(&velocity.angle), 
                                   sizeof(velocity.angle)));
	  checkResult (ptdrmixed->GetMemberType (1, &pTDmem));
	  checkResult (pTDmem->QueryInterface (IID_IAAFTypeDefInt,
                                      (void **) &pTDIntMem));
	  checkResult (pTDIntMem->GetInteger (pPVvelocitySpeed, 
	                           (aafMemPtr_t)(&velocity.speed),
	                           sizeof(velocity.speed)));

	  checkExpression (15 == velocity.angle, AAFRESULT_TEST_FAILED);
	  checkExpression (2001 == velocity.speed, AAFRESULT_TEST_FAILED);

	  // Try to read the first one
	  Rational16pair_t valA = { {1, 2}, {3, 4} };
	  CheckRational16PairByValues (ptdr16p, ptdr16, pPVa, valA);


	  // Try to read the second one
	  Rational16pair_t valB = { {5, 6}, {7, 8} };
	  CheckRational16PairByValues (ptdr16p, ptdr16, pPVb, valB);

          // Check misc. error return conditions for TypeDefRecord GetValue
          IAAFPropertyValueSP junkPv;
	  temphr = ptdr16->GetValue (0, 1, &junkPv);
	  checkExpression (AAFRESULT_NULL_PARAM == temphr,
					   AAFRESULT_TEST_FAILED);
	  temphr = ptdr16p->GetValue (pPVb, 1, 0);
	  checkExpression (AAFRESULT_NULL_PARAM == temphr,
					   AAFRESULT_TEST_FAILED);

	  // Read the last two with GetStruct just to get it over with. ;)
	  Rational16pair_t valC = { {9, 10}, {11, 12} };
	  CheckRational16PairByValues (ptdr16p, ptdr16, pPVc, valC);

	  // test variable array of records
	  // perform this part only for specified versions
	  if( versionUInt(testVer) >= versionUInt(1,1,1,0) )
	  {
		IAAFPropertyDefSP pPdPosN;
		checkResult (defs.cdCompositionMob()->LookupPropertyDef (sPropertyId_positionN,	&pPdPosN));
		IAAFPropertyValueSP pPVN;
		checkResult (pObj->GetPropertyValue (pPdPosN, &pPVN));

		// get the middle element of the array, 9abc
		IAAFPropertyValueSP pPVN1;
		checkResult (ptdvaarpr->GetElementValue (pPVN, 1, &pPVN1));

		// Read the value with GetStruct
		Rational16pair_t valN1 = { {9,10},{11,12} };
		CheckRational16PairByValues (ptdr16p, ptdr16, pPVN1, valN1);
	  }

	  // Attempt to close the file.
	  checkResult(pFile->Close());
	  IAAFFileSP nullFile;
	  pFile = nullFile;  // zeros the pFile, and releases it.

	  hr = AAFRESULT_SUCCESS;
	}
  catch (HRESULT& rResult)
	{
	  hr = rResult;
	}
	
  // cleanup
  if (pFile)
	{
	  pFile->Close();
	}
	
  return hr;
}
Esempio n. 3
0
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
  IAAFFileSP           pFile;
  IAAFHeaderSP         pHeader;
  IEnumAAFMobsSP       pMobIter;
  IAAFMobSP            pMob;
  IEnumAAFMobSlotsSP   pSlotIter;
  IAAFMobSlotSP        pSlot;
  IAAFComponentSP      pComp;
  IAAFSegmentSP        pSegment;
  IAAFDataDefSP        pDataDef;
  IAAFSequenceSP       pSequence;
  IAAFDictionarySP     pDictionary;
  IEnumAAFComponentsSP pCompIter;
  aafNumSlots_t        numMobs;
  aafSearchCrit_t      criteria;
  HRESULT              hr = S_OK;
	
  try
	{
	  // Open the AAF file
	  checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));

	  // Get the AAF file header.
	  checkResult(pFile->GetHeader(&pHeader));
		
	  // Validate that there is only one composition mob.
	  checkResult(pHeader->CountMobs(kAAFCompMob, &numMobs));
	  checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
		
	  // Get the AAF Dictionary so that we can create valid AAF objects.
	  checkResult(pHeader->GetDictionary(&pDictionary));
	  CAAFBuiltinDefs defs (pDictionary);

	  // Check a data definition from a composition MOB in order to test weak references
	  criteria.searchTag = kAAFByMobKind;
	  criteria.tags.mobKind = kAAFCompMob;
	  checkResult(pHeader->GetMobs(&criteria, &pMobIter));
	  while (pMobIter && pMobIter->NextOne(&pMob) == AAFRESULT_SUCCESS)
		{					
		  // Enumerate the first MOB slot for this MOB
		  checkResult(pMob->GetSlots(&pSlotIter));
		  checkResult(pSlotIter->NextOne(&pSlot));

		  checkResult(pSlot->GetSegment(&pSegment));
		  checkResult(pSegment->QueryInterface(IID_IAAFSequence, (void **) &pSequence));
		  checkResult(pSequence->GetComponents(&pCompIter));
		  checkResult(pCompIter->NextOne(&pComp));

		  aafBool  testBool;

		  checkResult(pComp->GetDataDef(&pDataDef));
		  checkResult(pDataDef->IsSoundKind(&testBool));
		  checkExpression(testBool == kAAFFalse, AAFRESULT_TEST_FAILED);

		  checkResult(pDataDef->IsDataDefOf(defs.ddkAAFPictureWithMatte(), &testBool));
		  checkExpression(testBool == kAAFTrue, AAFRESULT_TEST_FAILED);
		
		  // Make sure first component is a filler, and is our extended
		  // class.  To do that, we'll compare the class def we looked
		  // up in the dict, with the one we got from the new object.
		  //
		  // First get the class from the object.
		  IAAFFillerSP pFill;
		  checkResult(pComp->QueryInterface(IID_IAAFFiller,
											(void **) &pFill));
		  assert (pFill);

		  IAAFObjectSP pObj;
		  checkResult(pFill->QueryInterface(IID_IAAFObject,
											(void **) &pObj));
		  assert (pObj);
		  IAAFClassDefSP pClassFromObj;
		  checkResult (pObj->GetDefinition (&pClassFromObj));
		  assert (pClassFromObj);
		  IUnknownSP pUnkFromObj;
		  checkResult(pClassFromObj->QueryInterface(IID_IUnknown,
													(void **) &pUnkFromObj));

		  // Now get the class from the dict
		  IAAFClassDefSP pClassFromDict;
		  checkResult (pDictionary->LookupClassDef (kClassAUID_NewFill,
													&pClassFromDict));
		  assert (pClassFromDict);
		  IUnknownSP pUnkFromDict;
		  checkResult(pClassFromDict->QueryInterface(IID_IUnknown,
													 (void **) &pUnkFromDict));

		  // Compare class from object with class from dict.  Compare
		  // using IUnknown pointers.
		  assert (((IUnknown*)pUnkFromObj) ==
				  ((IUnknown*)pUnkFromDict));

		  // To test GetClassDefinitions(), try explicit lookup.
		  IEnumAAFClassDefsSP pClassDefEnum;
		  checkResult (pDictionary->GetClassDefs (&pClassDefEnum));
		  bool found = false;
		  IAAFClassDefSP cd;
		  while (SUCCEEDED (pClassDefEnum->NextOne (&cd)))
			{
			  IAAFMetaDefinitionSP def;
			  checkResult(cd->QueryInterface(IID_IAAFMetaDefinition,
											 (void **) &def));
			  aafUID_t classid;
			  checkResult (def->GetAUID (&classid));
			  if (EqualGUID (&classid, &kClassAUID_NewFill))
				{
				  // Found it the hard way.
				  found = true;
				  break;
				}
			}
		  // make sure we found it the hard way.
		  checkExpression(found == kAAFTrue, AAFRESULT_TEST_FAILED);

		  // Get the 'odor' property from our new fill clip.  Make
		  // sure it is set to the value we think it should be
		  // ('42').
		  //
		  // First get the property def from the class.
		  IAAFPropertyDefSP pPropDef;
		  checkResult (pClassFromObj->LookupPropertyDef
					   (kPropAUID_NewFill_Odor,
						&pPropDef));
		  //
		  // Get the property value from the object
		  IAAFPropertyValueSP pPropVal;
		  checkResult (pObj->GetPropertyValue (pPropDef, &pPropVal));
		  // 
		  // We know the property is int32; get the int32 type def
		  IAAFTypeDefSP ptd;
		  checkResult (pDictionary->LookupTypeDef
					   (kAAFTypeID_UInt32,
						&ptd));
		  IAAFTypeDefIntSP pTDUint32;
		  checkResult(ptd->QueryInterface(IID_IAAFTypeDefInt,
										  (void **) &pTDUint32));
		  assert (pTDUint32);
		  //
		  // Ask the typedef to interpret this property value for us.
		  aafUInt32 odorValue = 0;
		  checkResult (pTDUint32->GetInteger
					   (pPropVal,
						(aafMemPtr_t) &odorValue,
						sizeof (odorValue)));
		  //
		  // make sure it's what we expect.
		  assert (42 == odorValue);
		}

	  checkResult (LookupDefs (pDictionary));


	//Test the Lookup KLV and Tagged methods
	IAAFKLVDataDefinition *pKLVLook = NULL;
	IAAFTaggedValueDefinition *pTAGDefLook = NULL;
	IAAFDictionary2 *pDic2 = NULL;	
	IAAFDefObject *pKLVDataDefObj = NULL;
	IAAFDefObject *pTaggedValueDefObj = NULL;
	aafUID_t auid;

	checkResult( pDictionary->QueryInterface( IID_IAAFDictionary2, reinterpret_cast<void**>(&pDic2) ) );
	assert(pDic2);
	
	//test LookUpKLV()
	if(pDic2->LookupKLVDataDef(KLVDef_TestData, &pKLVLook) != AAFRESULT_SUCCESS)
		checkResult(AAFRESULT_TEST_FAILED);

	checkResult( pKLVLook->QueryInterface( IID_IAAFDefObject, reinterpret_cast<void**>(&pKLVDataDefObj) ) );
	assert(pKLVDataDefObj);
	
	//ensure the KLVLook auid is equal to KLVDef_TestData auid
	checkResult(pKLVDataDefObj->GetAUID(&auid));

	if(auid != KLVDef_TestData)
		checkResult(AAFRESULT_TEST_FAILED);

	//test LookUpTagged()
	if(pDic2->LookupTaggedValueDef(TAGDef_TestData, &pTAGDefLook) != AAFRESULT_SUCCESS)
		checkResult(AAFRESULT_TEST_FAILED);

	checkResult( pTAGDefLook->QueryInterface( IID_IAAFDefObject, reinterpret_cast<void**>(&pTaggedValueDefObj) ) );
	assert(pTaggedValueDefObj);
	
	//ensure the TAGDefLook auid is equal to TAGDef_TestData auid
	checkResult(pTaggedValueDefObj->GetAUID(&auid));

	if(auid != TAGDef_TestData)
		checkResult(AAFRESULT_TEST_FAILED);


	//cleanup	
	pDic2->Release();
	pDic2 = NULL;
	pKLVLook->Release();
	pKLVLook = NULL;
	pTAGDefLook->Release();
	pTAGDefLook = NULL;
	pKLVDataDefObj->Release();
	pKLVDataDefObj = NULL;
	pTaggedValueDefObj->Release();
	pTaggedValueDefObj = NULL;

	}

  catch (HRESULT& rResult)
	{
	  hr = rResult;
	}
	
  // Cleanup and return.
  if (pFile)
	{
	  pFile->Close();
	}
  return 	hr;
}