diff 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
line wrap: on
line diff
--- a/OrthancServer/UnitTestsSources/UnitTestsMain.cpp	Wed Jun 10 21:27:31 2020 +0200
+++ b/OrthancServer/UnitTestsSources/UnitTestsMain.cpp	Wed Jun 10 21:43:31 2020 +0200
@@ -39,7 +39,10 @@
 #include "../../OrthancFramework/Sources/Logging.h"
 #include "../../OrthancFramework/Sources/Toolbox.h"
 #include "../../OrthancFramework/Sources/OrthancException.h"
+#include "../../OrthancFramework/Sources/Images/Image.h"
+#include "../../OrthancFramework/Sources/Images/PngWriter.h"
 
+#include "../Sources/OrthancConfiguration.h"  // For the FontRegistry
 #include "../Sources/OrthancInitialization.h"
 #include "../Sources/ServerEnumerations.h"
 
@@ -117,6 +120,23 @@
 
 
 
+TEST(FontRegistry, Basic)
+{
+  Orthanc::Image s(Orthanc::PixelFormat_RGB24, 640, 480, false);
+  memset(s.GetBuffer(), 0, s.GetPitch() * s.GetHeight());
+
+  {
+    Orthanc::OrthancConfiguration::ReaderLock lock;
+    ASSERT_GE(1u, lock.GetConfiguration().GetFontRegistry().GetSize());
+    lock.GetConfiguration().GetFontRegistry().GetFont(0).Draw
+      (s, "Hello world É\n\rComment ça va ?\nq", 50, 60, 255, 0, 0);
+  }
+
+  Orthanc::PngWriter w;
+  w.WriteToFile("UnitTestsResults/font.png", s);
+}
+
+
 int main(int argc, char **argv)
 {
   Logging::Initialize();