comparison OrthancStone/UnitTestsSources/UnitTestsMain.cpp @ 1877:a2955abe4c2e

skeleton for the RenderingPlugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jan 2022 08:23:38 +0100
parents UnitTestsSources/UnitTestsMain.cpp@7053b8a0aaec
children 07964689cb0b
comparison
equal deleted inserted replaced
1876:b1f510e601d2 1877:a2955abe4c2e
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
7 *
8 * This program is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
21 **/
22
23
24 #include <gtest/gtest.h>
25
26 #include "../Sources/StoneEnumerations.h"
27 #include "../Sources/StoneInitialization.h"
28
29 #include <Logging.h>
30
31 #if defined(__EMSCRIPTEN__)
32 # include <emscripten.h>
33 #endif
34
35
36
37 TEST(Enumerations, Basic)
38 {
39 using namespace OrthancStone;
40 ASSERT_EQ(SopClassUid_EncapsulatedPdf, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.104.1"));
41 ASSERT_EQ(SopClassUid_RTStruct, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.481.3"));
42 ASSERT_EQ(SopClassUid_RTDose, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.481.2"));
43 ASSERT_EQ(SopClassUid_RTPlan, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.481.5"));
44 ASSERT_EQ(SopClassUid_VideoEndoscopicImageStorage, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.77.1.1.1"));
45 ASSERT_EQ(SopClassUid_VideoMicroscopicImageStorage, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.77.1.2.1"));
46 ASSERT_EQ(SopClassUid_VideoPhotographicImageStorage, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.77.1.4.1"));
47 ASSERT_EQ(SopClassUid_Other, StringToSopClassUid("nope"));
48
49 ASSERT_EQ(SeriesThumbnailType_Pdf, GetSeriesThumbnailType(SopClassUid_EncapsulatedPdf));
50 ASSERT_EQ(SeriesThumbnailType_Video, GetSeriesThumbnailType(SopClassUid_VideoEndoscopicImageStorage));
51 ASSERT_EQ(SeriesThumbnailType_Video, GetSeriesThumbnailType(SopClassUid_VideoMicroscopicImageStorage));
52 ASSERT_EQ(SeriesThumbnailType_Video, GetSeriesThumbnailType(SopClassUid_VideoPhotographicImageStorage));
53 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_Other));
54 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_RTDose));
55 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_RTStruct));
56 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_RTPlan));
57 }
58
59
60 int main(int argc, char **argv)
61 {
62 #if defined(__EMSCRIPTEN__)
63 std::string output;
64 #endif
65
66 int result;
67
68 {
69 OrthancStone::StoneInitialize();
70 Orthanc::Logging::EnableInfoLevel(true);
71
72 ::testing::InitGoogleTest(&argc, argv);
73
74 #if defined(__EMSCRIPTEN__)
75 ::testing::internal::CaptureStdout();
76 #endif
77
78 result = RUN_ALL_TESTS();
79
80 #if defined(__EMSCRIPTEN__)
81 output = testing::internal::GetCapturedStdout();
82 #endif
83
84 OrthancStone::StoneFinalize();
85 }
86
87 #if defined(__EMSCRIPTEN__)
88 EM_ASM({
89 document.getElementById("output").innerHTML = UTF8ToString($0);
90 window.scrollTo(0, document.body.scrollHeight); // Scroll to the end of the page
91 },
92 output.c_str());
93 #endif
94
95 return result;
96 }