Audio plugin host https://kx.studio/carla
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.

152 lines
5.7KB

  1. //-----------------------------------------------------------------------------
  2. // Project : SDK Core
  3. // Version : 1.0
  4. //
  5. // Category : SDK Core Interfaces
  6. // Filename : pluginterfaces/test/itest.h
  7. // Created by : Steinberg, 01/2005
  8. // Description : Test Interface - Availability Depends on HOST
  9. //
  10. //-----------------------------------------------------------------------------
  11. // This file is part of a Steinberg SDK. It is subject to the license terms
  12. // in the LICENSE file found in the top-level directory of this distribution
  13. // and at www.steinberg.net/sdklicenses.
  14. // No part of the SDK, including this file, may be copied, modified, propagated,
  15. // or distributed except according to the terms contained in the LICENSE file.
  16. //-----------------------------------------------------------------------------
  17. #pragma once
  18. #include "pluginterfaces/base/funknown.h"
  19. #ifndef kTestClass
  20. #define kTestClass "Test Class" ///< A class for automated tests
  21. #endif
  22. namespace Steinberg {
  23. class ITestResult;
  24. //------------------------------------------------------------------------
  25. // ITest interface declaration
  26. //------------------------------------------------------------------------
  27. class ITest : public FUnknown
  28. {
  29. public:
  30. //--- ---------------------------------------------------------------------
  31. /** called immediately before the test is actually run.
  32. Usually this will be used to setup the test environment.
  33. \return true upon success */
  34. virtual bool PLUGIN_API setup () = 0;
  35. /** execute the test.
  36. \param testResult : points to a test result where the test can
  37. (optionally) add an error message.
  38. \return true upon success
  39. \sa ITestResult */
  40. virtual bool PLUGIN_API run (ITestResult* testResult) = 0;
  41. /** called after the test has run. This method shall be used to
  42. deconstruct a test environment that has been setup with ITest::setup ().
  43. \return true upon success */
  44. virtual bool PLUGIN_API teardown () = 0;
  45. /** This function is used to provide information about the performed
  46. testcase. What is done, what is validated and what has to be prepared
  47. before executing the test (in case of half-automated tests).
  48. \return null terminated string upon success, zero otherwise */
  49. virtual const tchar* PLUGIN_API getDescription () {return 0;}
  50. //--- ---------------------------------------------------------------------
  51. static const FUID iid;
  52. };
  53. #ifdef UNICODE
  54. DECLARE_CLASS_IID (ITest, 0xFE64FC19, 0x95684F53, 0xAAA78DC8, 0x7228338E)
  55. #else
  56. DECLARE_CLASS_IID (ITest, 0x9E2E608B, 0x64C64CF8, 0x839059BD, 0xA194032D)
  57. #endif
  58. //------------------------------------------------------------------------
  59. // ITestResult interface declaration
  60. //------------------------------------------------------------------------
  61. /** Test Result message logger
  62. [host imp]
  63. when a test is called, a pointer to an ITestResult is passed in, so the
  64. test class can output error messages
  65. */
  66. //------------------------------------------------------------------------
  67. class ITestResult : public FUnknown
  68. {
  69. public:
  70. //--- ---------------------------------------------------------------------
  71. /** add an error message */
  72. virtual void PLUGIN_API addErrorMessage (const tchar* msg) = 0;
  73. virtual void PLUGIN_API addMessage (const tchar* msg) = 0;
  74. //--- ---------------------------------------------------------------------
  75. static const FUID iid;
  76. };
  77. #ifdef UNICODE
  78. DECLARE_CLASS_IID (ITestResult, 0x69796279, 0xF651418B, 0xB24D79B7, 0xD7C527F4)
  79. #else
  80. DECLARE_CLASS_IID (ITestResult, 0xCE13B461, 0x5334451D, 0xB3943E99, 0x7446885B)
  81. #endif
  82. //------------------------------------------------------------------------
  83. // ITestSuite interface declaration
  84. //------------------------------------------------------------------------
  85. /** A collection of tests supporting a hierarchical ordering
  86. [host imp]
  87. [create via hostclasses]*/
  88. //------------------------------------------------------------------------
  89. class ITestSuite : public FUnknown
  90. {
  91. public:
  92. //--- ---------------------------------------------------------------------
  93. /** append a new test */
  94. virtual tresult PLUGIN_API addTest (FIDString name, ITest* test) = 0;
  95. /** append an entire test suite as a child suite */
  96. virtual tresult PLUGIN_API addTestSuite (FIDString name, ITestSuite* testSuite) = 0;
  97. virtual tresult PLUGIN_API setEnvironment (ITest* environment) = 0;
  98. //--- ---------------------------------------------------------------------
  99. static const FUID iid;
  100. };
  101. #ifdef UNICODE
  102. DECLARE_CLASS_IID (ITestSuite, 0x5CA7106F, 0x98784AA5, 0xB4D30D71, 0x2F5F1498)
  103. #else
  104. DECLARE_CLASS_IID (ITestSuite, 0x81724C94, 0xE9F64F65, 0xACB104E9, 0xCC702253)
  105. #endif
  106. //------------------------------------------------------------------------
  107. // ITestFactory interface declaration
  108. //------------------------------------------------------------------------
  109. /** Class factory that any testable module defines for creating tests
  110. that will be executed from the host
  111. [plug imp] \n
  112. */
  113. //------------------------------------------------------------------------
  114. class ITestFactory : public FUnknown
  115. {
  116. public:
  117. //--- ---------------------------------------------------------------------
  118. /** create the tests that this module provides.
  119. \param parentSuite : the test suite that the newly created tests
  120. shall register with. */
  121. virtual tresult PLUGIN_API createTests (FUnknown* context, ITestSuite* parentSuite) = 0;
  122. //--- ---------------------------------------------------------------------
  123. static const FUID iid;
  124. };
  125. #ifdef UNICODE
  126. DECLARE_CLASS_IID (ITestFactory, 0xAB483D3A, 0x15264650, 0xBF86EEF6, 0x9A327A93)
  127. #else
  128. DECLARE_CLASS_IID (ITestFactory, 0xE77EA913, 0x58AA4838, 0x986A4620, 0x53579080)
  129. #endif
  130. //------------------------------------------------------------------------
  131. } // namespace Steinberg