Mercurial > hg > orthanc-stone
comparison UnitTestsSources/DicomTests.cpp @ 1725:c8d0ffb3047d
DicomSource::IsSameSource()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 01 Dec 2020 17:43:31 +0100 |
parents | 5b8b88e5bfd6 |
children | 9ac2a65d4172 |
comparison
equal
deleted
inserted
replaced
1724:7b17090ed2ab | 1725:c8d0ffb3047d |
---|---|
20 | 20 |
21 | 21 |
22 #include <gtest/gtest.h> | 22 #include <gtest/gtest.h> |
23 | 23 |
24 #include "../OrthancStone/Sources/Toolbox/DicomInstanceParameters.h" | 24 #include "../OrthancStone/Sources/Toolbox/DicomInstanceParameters.h" |
25 #include "../OrthancStone/Sources/Loaders/DicomSource.h" | |
25 | 26 |
26 #include <OrthancException.h> | 27 #include <OrthancException.h> |
27 | 28 |
28 | 29 |
29 static void SetupUids(Orthanc::DicomMap& m) | 30 static void SetupUids(Orthanc::DicomMap& m) |
105 float c, w; | 106 float c, w; |
106 p.GetWindowingPresetsUnion(c, w); | 107 p.GetWindowingPresetsUnion(c, w); |
107 ASSERT_FLOAT_EQ((a + b) / 2.0f, c); | 108 ASSERT_FLOAT_EQ((a + b) / 2.0f, c); |
108 ASSERT_FLOAT_EQ(b - a, w); | 109 ASSERT_FLOAT_EQ(b - a, w); |
109 } | 110 } |
111 | |
112 | |
113 TEST(DicomSource, Equality) | |
114 { | |
115 { | |
116 OrthancStone::DicomSource s1; | |
117 | |
118 { | |
119 OrthancStone::DicomSource s2; | |
120 ASSERT_TRUE(s1.IsSameSource(s2)); | |
121 | |
122 s2.SetDicomDirSource(); | |
123 ASSERT_FALSE(s1.IsSameSource(s2)); | |
124 | |
125 s2.SetDicomWebSource("toto"); | |
126 ASSERT_FALSE(s1.IsSameSource(s2)); | |
127 | |
128 s2.SetDicomWebThroughOrthancSource("toto"); | |
129 ASSERT_FALSE(s1.IsSameSource(s2)); | |
130 | |
131 s2.SetOrthancSource(); | |
132 ASSERT_TRUE(s1.IsSameSource(s2)); | |
133 } | |
134 } | |
135 | |
136 { | |
137 OrthancStone::DicomSource s1; | |
138 | |
139 { | |
140 Orthanc::WebServiceParameters p; | |
141 p.SetUrl("http://localhost:8042/"); | |
142 | |
143 OrthancStone::DicomSource s2; | |
144 s2.SetOrthancSource(p); | |
145 ASSERT_TRUE(s1.IsSameSource(s2)); | |
146 | |
147 p.SetCredentials("toto", "tutu"); | |
148 s2.SetOrthancSource(p); | |
149 ASSERT_FALSE(s1.IsSameSource(s2)); | |
150 | |
151 p.ClearCredentials(); | |
152 s2.SetOrthancSource(p); | |
153 ASSERT_TRUE(s1.IsSameSource(s2)); | |
154 | |
155 p.SetUrl("http://localhost:8043/"); | |
156 s2.SetOrthancSource(p); | |
157 ASSERT_FALSE(s1.IsSameSource(s2)); | |
158 } | |
159 } | |
160 | |
161 { | |
162 OrthancStone::DicomSource s1; | |
163 s1.SetDicomDirSource(); | |
164 | |
165 { | |
166 OrthancStone::DicomSource s2; | |
167 ASSERT_FALSE(s1.IsSameSource(s2)); | |
168 | |
169 s2.SetDicomDirSource(); | |
170 ASSERT_TRUE(s1.IsSameSource(s2)); | |
171 | |
172 s2.SetDicomWebSource("toto"); | |
173 ASSERT_FALSE(s1.IsSameSource(s2)); | |
174 | |
175 s2.SetDicomWebThroughOrthancSource("toto"); | |
176 ASSERT_FALSE(s1.IsSameSource(s2)); | |
177 } | |
178 } | |
179 | |
180 { | |
181 OrthancStone::DicomSource s1; | |
182 s1.SetDicomWebSource("http"); | |
183 | |
184 { | |
185 OrthancStone::DicomSource s2; | |
186 ASSERT_FALSE(s1.IsSameSource(s2)); | |
187 | |
188 s2.SetDicomDirSource(); | |
189 ASSERT_FALSE(s1.IsSameSource(s2)); | |
190 | |
191 s2.SetDicomWebSource("http"); | |
192 ASSERT_TRUE(s1.IsSameSource(s2)); | |
193 | |
194 s2.SetDicomWebSource("http2"); | |
195 ASSERT_FALSE(s1.IsSameSource(s2)); | |
196 | |
197 s2.SetDicomWebThroughOrthancSource("toto"); | |
198 ASSERT_FALSE(s1.IsSameSource(s2)); | |
199 } | |
200 } | |
201 | |
202 { | |
203 OrthancStone::DicomSource s1; | |
204 s1.SetDicomWebThroughOrthancSource("server"); | |
205 | |
206 { | |
207 OrthancStone::DicomSource s2; | |
208 ASSERT_FALSE(s1.IsSameSource(s2)); | |
209 | |
210 s2.SetDicomDirSource(); | |
211 ASSERT_FALSE(s1.IsSameSource(s2)); | |
212 | |
213 s2.SetDicomWebSource("http"); | |
214 ASSERT_FALSE(s1.IsSameSource(s2)); | |
215 | |
216 s2.SetDicomWebThroughOrthancSource("server"); | |
217 ASSERT_TRUE(s1.IsSameSource(s2)); | |
218 | |
219 s2.SetDicomWebThroughOrthancSource("server2"); | |
220 ASSERT_FALSE(s1.IsSameSource(s2)); | |
221 } | |
222 } | |
223 } |