comparison OrthancServer/UnitTestsSources/UnitTestsMain.cpp @ 4046:7ff1e6c80627 framework

moving ImageTests.cpp to framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 21:43:31 +0200
parents 05b8fd21089c
children 9214e3a7b0a2
comparison
equal deleted inserted replaced
4045:05b8fd21089c 4046:7ff1e6c80627
37 #include "gtest/gtest.h" 37 #include "gtest/gtest.h"
38 38
39 #include "../../OrthancFramework/Sources/Logging.h" 39 #include "../../OrthancFramework/Sources/Logging.h"
40 #include "../../OrthancFramework/Sources/Toolbox.h" 40 #include "../../OrthancFramework/Sources/Toolbox.h"
41 #include "../../OrthancFramework/Sources/OrthancException.h" 41 #include "../../OrthancFramework/Sources/OrthancException.h"
42 #include "../../OrthancFramework/Sources/Images/Image.h"
43 #include "../../OrthancFramework/Sources/Images/PngWriter.h"
42 44
45 #include "../Sources/OrthancConfiguration.h" // For the FontRegistry
43 #include "../Sources/OrthancInitialization.h" 46 #include "../Sources/OrthancInitialization.h"
44 #include "../Sources/ServerEnumerations.h" 47 #include "../Sources/ServerEnumerations.h"
45 48
46 49
47 using namespace Orthanc; 50 using namespace Orthanc;
115 ASSERT_STREQ("GenericNoWildcardInDates", EnumerationToString(StringToModalityManufacturer("AgfaImpax"))); 118 ASSERT_STREQ("GenericNoWildcardInDates", EnumerationToString(StringToModalityManufacturer("AgfaImpax")));
116 } 119 }
117 120
118 121
119 122
123 TEST(FontRegistry, Basic)
124 {
125 Orthanc::Image s(Orthanc::PixelFormat_RGB24, 640, 480, false);
126 memset(s.GetBuffer(), 0, s.GetPitch() * s.GetHeight());
127
128 {
129 Orthanc::OrthancConfiguration::ReaderLock lock;
130 ASSERT_GE(1u, lock.GetConfiguration().GetFontRegistry().GetSize());
131 lock.GetConfiguration().GetFontRegistry().GetFont(0).Draw
132 (s, "Hello world É\n\rComment ça va ?\nq", 50, 60, 255, 0, 0);
133 }
134
135 Orthanc::PngWriter w;
136 w.WriteToFile("UnitTestsResults/font.png", s);
137 }
138
139
120 int main(int argc, char **argv) 140 int main(int argc, char **argv)
121 { 141 {
122 Logging::Initialize(); 142 Logging::Initialize();
123 Toolbox::InitializeGlobalLocale(NULL); 143 Toolbox::InitializeGlobalLocale(NULL);
124 Logging::EnableInfoLevel(true); 144 Logging::EnableInfoLevel(true);