Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
4.7 KiB

  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <commctrl.h>
  4. #include <s98inc.h>
  5. #include "DmoTestCases.h"
  6. #include "dmotest.h"
  7. /*=============================================================================
  8. | MEMBER FUNCTION DEFINITIONS
  9. |------------------------------------------------------------------------------
  10. | CDmoTestCase1
  11. \============================================================================*/
  12. /*-----------------------------------------------------------------------------
  13. | Function: CDmoTestCase1
  14. | Purpose: Constructor (wrapper for CDmoTestCase function)
  15. | Arguments: ID, Name, and container class, Function to be called by RunTest
  16. | Returns: Void
  17. \----------------------------------------------------------------------------*/
  18. CDmoTestCase1::CDmoTestCase1( LPSTR pszNewCaseID,
  19. LPSTR pszNewName,
  20. DMOTESTFNPROC1 pfnNewTest,
  21. CDmoTest* dmoTest)
  22. : CDmoTestCase(pszNewCaseID, pszNewName, dmoTest),
  23. pfnTest(pfnNewTest)
  24. {
  25. }
  26. /*-----------------------------------------------------------------------------
  27. | Function: ~CDmoTestCase1
  28. | Purpose: Destructor
  29. | Arguments: None
  30. | Returns: Void
  31. \----------------------------------------------------------------------------*/
  32. CDmoTestCase1::~CDmoTestCase1()
  33. {
  34. }
  35. /*-----------------------------------------------------------------------------
  36. | Function: RunTest
  37. | Purpose: called by runtest
  38. | Arguments: None
  39. | Returns: 0
  40. \----------------------------------------------------------------------------*/
  41. DWORD
  42. CDmoTestCase1::RunTest()
  43. {
  44. LPSTR szDmoName;
  45. LPSTR szDmoClsid;
  46. int iNumTestFiles;
  47. LPSTR szFileName;
  48. DWORD dwResult = FNS_PASS;
  49. int iNumComponent = m_pDmoTest->GetNumComponent();
  50. int iNumSelectedComponent = m_pDmoTest->GetNumSelectedDmo();
  51. if(iNumSelectedComponent == 0)
  52. {
  53. MessageBox(
  54. NULL,
  55. "No DMOs selected.",
  56. "Error!",
  57. MB_OK | MB_ICONINFORMATION);
  58. return FNS_FAIL;
  59. }
  60. for(int i=0; i<iNumComponent; i++)
  61. {
  62. szDmoName = m_pDmoTest->GetDmoName(i);
  63. if( m_pDmoTest->IsDmoSelected(i))
  64. {
  65. g_IShell->Log(1, "\n<=====DMO Under Test: %s.=====> \n", szDmoName);
  66. szDmoClsid = m_pDmoTest->GetDmoClsid(i);
  67. iNumTestFiles = m_pDmoTest->GetNumTestFile(i);
  68. if( iNumTestFiles == 0)
  69. {
  70. MessageBox(
  71. NULL,
  72. "No test files selected.",
  73. "Error!",
  74. MB_OK | MB_ICONINFORMATION);
  75. return FNS_FAIL;
  76. }
  77. for (int j=0; j< iNumTestFiles; j++)
  78. {
  79. szFileName = m_pDmoTest->GetFileName(i, j);
  80. if( pfnTest(szDmoClsid, szFileName) != FNS_PASS)
  81. dwResult = FNS_FAIL;
  82. }
  83. }
  84. }
  85. return dwResult;
  86. }
  87. /*=============================================================================
  88. | MEMBER FUNCTION DEFINITIONS
  89. |------------------------------------------------------------------------------
  90. | CDmoTestCase2
  91. \============================================================================*/
  92. /*-----------------------------------------------------------------------------
  93. | Function: CDmoTestCase2
  94. | Purpose: Constructor (wrapper for CDmoTestCase function)
  95. | Arguments: ID, Name, and container class, Function to be called by RunTest
  96. | Returns: Void
  97. \----------------------------------------------------------------------------*/
  98. CDmoTestCase2::CDmoTestCase2( LPSTR pszNewCaseID,
  99. LPSTR pszNewName,
  100. DMOTESTFNPROC2 pfnNewTest,
  101. CDmoTest* dmoTest)
  102. : CDmoTestCase(pszNewCaseID, pszNewName, dmoTest),
  103. pfnTest(pfnNewTest)
  104. {
  105. }
  106. /*-----------------------------------------------------------------------------
  107. | Function: ~CDmoTestCase2
  108. | Purpose: Destructor
  109. | Arguments: None
  110. | Returns: Void
  111. \----------------------------------------------------------------------------*/
  112. CDmoTestCase2::~CDmoTestCase2()
  113. {
  114. }
  115. /*-----------------------------------------------------------------------------
  116. | Function: RunTest
  117. | Purpose: called by runtest
  118. | Arguments: None
  119. | Returns: 0
  120. \----------------------------------------------------------------------------*/
  121. DWORD
  122. CDmoTestCase2::RunTest()
  123. {
  124. LPSTR szDmoName;
  125. LPSTR szDmoClsid;
  126. DWORD dwResult = FNS_PASS;
  127. int iNumComponent = m_pDmoTest->GetNumComponent();
  128. int iNumSelectedComponent = m_pDmoTest->GetNumSelectedDmo();
  129. if(iNumSelectedComponent == 0)
  130. {
  131. MessageBox(
  132. NULL,
  133. "No DMOs selected.",
  134. "Error!",
  135. MB_OK | MB_ICONINFORMATION);
  136. return FNS_FAIL;
  137. }
  138. for(int i=0; i<iNumComponent; i++)
  139. {
  140. szDmoName = m_pDmoTest->GetDmoName(i);
  141. if( m_pDmoTest->IsDmoSelected(i))
  142. {
  143. g_IShell->Log(1, "\n<=====DMO Under Test: %s.=====> \n", szDmoName);
  144. szDmoClsid = m_pDmoTest->GetDmoClsid(i);
  145. if(pfnTest(szDmoClsid) != FNS_PASS)
  146. dwResult = FNS_FAIL;
  147. }
  148. }
  149. return dwResult;
  150. }