Mercurial > hg > orthanc
comparison UnitTestsSources/ImageTests.cpp @ 2940:4767d36679ed
refactoring access to Orthanc configuration
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2018 11:47:00 +0100 |
parents | 38a3054b22ff |
children | 4e43e67f8ecf |
comparison
equal
deleted
inserted
replaced
2939:577786f59252 | 2940:4767d36679ed |
---|---|
41 #include "../Core/Images/JpegWriter.h" | 41 #include "../Core/Images/JpegWriter.h" |
42 #include "../Core/Images/PngReader.h" | 42 #include "../Core/Images/PngReader.h" |
43 #include "../Core/Images/PngWriter.h" | 43 #include "../Core/Images/PngWriter.h" |
44 #include "../Core/Images/PamReader.h" | 44 #include "../Core/Images/PamReader.h" |
45 #include "../Core/Images/PamWriter.h" | 45 #include "../Core/Images/PamWriter.h" |
46 #include "../Core/SystemToolbox.h" | |
46 #include "../Core/Toolbox.h" | 47 #include "../Core/Toolbox.h" |
47 #include "../Core/TemporaryFile.h" | 48 #include "../Core/TemporaryFile.h" |
48 #include "../OrthancServer/OrthancInitialization.h" // For the FontRegistry | 49 #include "../OrthancServer/OrthancConfiguration.h" // For the FontRegistry |
49 | 50 |
50 #include <stdint.h> | 51 #include <stdint.h> |
51 | 52 |
52 | 53 |
53 TEST(PngWriter, ColorPattern) | 54 TEST(PngWriter, ColorPattern) |
262 TEST(Font, Basic) | 263 TEST(Font, Basic) |
263 { | 264 { |
264 Orthanc::Image s(Orthanc::PixelFormat_RGB24, 640, 480, false); | 265 Orthanc::Image s(Orthanc::PixelFormat_RGB24, 640, 480, false); |
265 memset(s.GetBuffer(), 0, s.GetPitch() * s.GetHeight()); | 266 memset(s.GetBuffer(), 0, s.GetPitch() * s.GetHeight()); |
266 | 267 |
267 ASSERT_GE(1u, Orthanc::Configuration::GetFontRegistry().GetSize()); | 268 { |
268 Orthanc::Configuration::GetFontRegistry().GetFont(0).Draw(s, "Hello world É\n\rComment ça va ?\nq", 50, 60, 255, 0, 0); | 269 Orthanc::OrthancConfiguration::ReaderLock lock; |
270 ASSERT_GE(1u, lock.GetConfiguration().GetFontRegistry().GetSize()); | |
271 lock.GetConfiguration().GetFontRegistry().GetFont(0).Draw | |
272 (s, "Hello world É\n\rComment ça va ?\nq", 50, 60, 255, 0, 0); | |
273 } | |
269 | 274 |
270 Orthanc::PngWriter w; | 275 Orthanc::PngWriter w; |
271 w.WriteToFile("UnitTestsResults/font.png", s); | 276 w.WriteToFile("UnitTestsResults/font.png", s); |
272 } | 277 } |
273 | 278 |