testcms2.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //---------------------------------------------------------------------------------
  2. //
  3. // Little Color Management System
  4. // Copyright (c) 1998-2022 Marti Maria Saguer
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining
  7. // a copy of this software and associated documentation files (the "Software"),
  8. // to deal in the Software without restriction, including without limitation
  9. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. // and/or sell copies of the Software, and to permit persons to whom the Software
  11. // is furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  18. // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  20. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  21. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. //
  24. //---------------------------------------------------------------------------------
  25. //
  26. #ifndef TESTCMS2_H
  27. #define TESTCMS2_H
  28. #include "lcms2_internal.h"
  29. // On Visual Studio, use debug CRT
  30. #ifdef _MSC_VER
  31. # include "crtdbg.h"
  32. #endif
  33. #ifdef CMS_IS_WINDOWS_
  34. # include <io.h>
  35. # include <direct.h>
  36. # define CHDIR(a) (void)_chdir(a)
  37. #else
  38. # include <unistd.h>
  39. # define CHDIR(a) (void)chdir(a)
  40. #endif
  41. #define cmsmin(a, b) (((a) < (b)) ? (a) : (b))
  42. // Used to mark special pointers
  43. void DebugMemDontCheckThis(void *Ptr);
  44. cmsBool IsGoodVal(const char *title, cmsFloat64Number in, cmsFloat64Number out, cmsFloat64Number max);
  45. cmsBool IsGoodFixed15_16(const char *title, cmsFloat64Number in, cmsFloat64Number out);
  46. cmsBool IsGoodFixed8_8(const char *title, cmsFloat64Number in, cmsFloat64Number out);
  47. cmsBool IsGoodWord(const char *title, cmsUInt16Number in, cmsUInt16Number out);
  48. cmsBool IsGoodWordPrec(const char *title, cmsUInt16Number in, cmsUInt16Number out, cmsUInt16Number maxErr);
  49. void* PluginMemHandler(void);
  50. cmsContext WatchDogContext(void* usr);
  51. void ResetFatalError(cmsContext ContextID);
  52. void Die(const char* Reason, ...);
  53. void Dot(void);
  54. void Fail(const char* frm, ...);
  55. void SubTest(const char* frm, ...);
  56. void TestMemoryLeaks(cmsBool ok);
  57. void Say(const char* str);
  58. // Plug-in tests
  59. cmsInt32Number CheckSimpleContext(cmsContext ContextID);
  60. cmsInt32Number CheckAllocContext(cmsContext ContextID);
  61. cmsInt32Number CheckAlarmColorsContext(cmsContext ContextID);
  62. cmsInt32Number CheckAdaptationStateContext(cmsContext ContextID);
  63. cmsInt32Number CheckInterp1DPlugin(cmsContext ContextID);
  64. cmsInt32Number CheckInterp3DPlugin(cmsContext ContextID);
  65. cmsInt32Number CheckParametricCurvePlugin(cmsContext ContextID);
  66. cmsInt32Number CheckFormattersPlugin(cmsContext ContextID);
  67. cmsInt32Number CheckTagTypePlugin(cmsContext ContextID);
  68. cmsInt32Number CheckMPEPlugin(cmsContext ContextID);
  69. cmsInt32Number CheckOptimizationPlugin(cmsContext ContextID);
  70. cmsInt32Number CheckIntentPlugin(cmsContext ContextID);
  71. cmsInt32Number CheckTransformPlugin(cmsContext ContextID);
  72. cmsInt32Number CheckMutexPlugin(cmsContext ContextID);
  73. cmsInt32Number CheckMethodPackDoublesFromFloat(cmsContext ContextID);
  74. // Zoo
  75. void CheckProfileZOO(cmsContext ContextID);
  76. #endif