Debian Codegraph @

packages/seacas/libraries/ioss/src/visualization/catalyst/test/parser/ImageSetRepresentationValidTests.cxx

raw
1 // Copyright(C) 1999-2021 National Technology & Engineering Solutions
2 // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 // NTESS, the U.S. Government retains certain rights in this software.
4 //
5 // See packages/seacas/LICENSE for details
6
7 #include "ImageSetRepresentationValidTests.h"
8 #include "CatalystTestFixture.h"
9 #include "catch.hpp"
10
11 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationSurfaces",
12 "[ImageSetRepresentationValid]")
13 {
14 Json::Value dj = getDefaultImageSetWithCameraJSON();
15
16 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
17 imageset["show surfaces"] = false;
18 imageset["show edges"] = true;
19
20 checkPhactoriStringValidParse(ImagesetRepresentationSurfaces, dj);
21 }
22
23 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationEdges",
24 "[ImageSetRepresentationValid]")
25 {
26 Json::Value dj = getDefaultImageSetWithCameraJSON();
27
28 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
29 imageset["show edges"] = true;
30
31 checkPhactoriStringValidParse(ImagesetRepresentationEdges, dj);
32 }
33
34 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationBoundingBox",
35 "[ImageSetRepresentationValid]")
36 {
37 Json::Value dj = getDefaultImageSetWithCameraJSON();
38
39 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
40 imageset["show surfaces"] = false;
41 imageset["show bounding box"] = true;
42
43 checkPhactoriStringValidParse(ImagesetRepresentationBoundingBox, dj);
44 }
45
46 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorByScalar",
47 "[ImageSetRepresentationValid]")
48 {
49 Json::Value dj = getDefaultImageSetWithCameraJSON();
50
51 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
52 imageset["color by scalar"] = "VON_MISES";
53
54 checkPhactoriStringValidParse(ImagesetRepresentationColorByScalar, dj);
55 }
56
57 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorByVectorMagnitude",
58 "[ImageSetRepresentationValid]")
59 {
60 Json::Value dj = getDefaultImageSetWithCameraJSON();
61
62 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
63 imageset["color by vector magnitude"] = "displ";
64
65 checkPhactoriStringValidParse(ImagesetRepresentationColorByVectorMagnitude, dj);
66 }
67
68 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorByVectorComponent",
69 "[ImageSetRepresentationValid]")
70 {
71 Json::Value dj = getDefaultImageSetWithCameraJSON();
72
73 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
74 imageset["color by vector component"] = "displ_x";
75
76 checkPhactoriStringValidParse(ImagesetRepresentationColorByVectorComponent, dj);
77 }
78
79 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorByTensorComponent",
80 "[ImageSetRepresentationValid]")
81 {
82 Json::Value dj = getDefaultImageSetWithCameraJSON();
83
84 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
85 imageset["color by tensor component"] = "stress_xy";
86
87 checkPhactoriStringValidParse(ImagesetRepresentationColorByTensorComponent, dj);
88 }
89
90 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorBySolidColor",
91 "[ImageSetRepresentationValid]")
92 {
93 Json::Value dj = getDefaultImageSetWithCameraJSON();
94
95 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
96 Json::Value color;
97 color[0] = 1.0;
98 color[1] = 0.5;
99 color[2] = 0.0;
100 imageset["color by solid color"] = color;
101
102 checkPhactoriStringValidParse(ImagesetRepresentationColorBySolidColor, dj);
103 }
104
105 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorByBlockId",
106 "[ImageSetRepresentationValid]")
107 {
108 Json::Value dj = getDefaultImageSetWithCameraJSON();
109
110 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
111 imageset["color by blockid"] = true;
112
113 checkPhactoriStringValidParse(ImagesetRepresentationColorByBlockId, dj);
114 }
115
116 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationTimeAnnotation",
117 "[ImageSetRepresentationValid]")
118 {
119 Json::Value dj = getDefaultImageSetWithCameraJSON();
120
121 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
122 imageset["show time annotation"] = true;
123
124 checkPhactoriStringValidParse(ImagesetRepresentationTimeAnnotation, dj);
125 }
126
127 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorLegend",
128 "[ImageSetRepresentationValid]")
129 {
130 Json::Value dj = getDefaultImageSetWithCameraJSON();
131
132 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
133 imageset["show color legend"] = true;
134 imageset["color by scalar"] = "VON_MISES";
135
136 checkPhactoriStringValidParse(ImagesetRepresentationColorLegend, dj);
137 }
138
139 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorLegendRange",
140 "[ImageSetRepresentationValid]")
141 {
142 Json::Value dj = getDefaultImageSetWithCameraJSON();
143
144 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
145 Json::Value range;
146 range[0] = 22.0;
147 range[1] = 32.0;
148 imageset["color legend range"] = range;
149 imageset["color by scalar"] = "VON_MISES";
150
151 checkPhactoriStringValidParse(ImagesetRepresentationColorLegendRange, dj);
152 }
153
154 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorLegendUseCurrentDataRange",
155 "[ImageSetRepresentationValid]")
156 {
157 Json::Value dj = getDefaultImageSetWithCameraJSON();
158
159 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
160 imageset["color legend use current data range"] = true;
161 imageset["color by tensor component"] = "stress_yz";
162
163 checkPhactoriStringValidParse(ImagesetRepresentationColorLegendUseCurrentDataRange, dj);
164 }
165
166 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorLegendUseCumulativeDataRange",
167 "[ImageSetRepresentationValid]")
168 {
169 Json::Value dj = getDefaultImageSetWithCameraJSON();
170
171 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
172 imageset["color legend use cumulative data range"] = true;
173 imageset["color by tensor component"] = "stress_yz";
174
175 checkPhactoriStringValidParse(ImagesetRepresentationColorLegendUseCumulativeDataRange, dj);
176 }
177
178 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorLegendMinimumRange",
179 "[ImageSetRepresentationValid]")
180 {
181 Json::Value dj = getDefaultImageSetWithCameraJSON();
182
183 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
184 Json::Value range;
185 range[0] = -5.0;
186 range[1] = 15.0;
187 imageset["color legend minimum range"] = range;
188 imageset["color by scalar"] = "VON_MISES";
189
190 checkPhactoriStringValidParse(ImagesetRepresentationColorLegendMinimumRange, dj);
191 }
192
193 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorLegendMaximumRange",
194 "[ImageSetRepresentationValid]")
195 {
196 Json::Value dj = getDefaultImageSetWithCameraJSON();
197
198 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
199 Json::Value range;
200 range[0] = -5.0;
201 range[1] = 15.0;
202 imageset["color legend maximum range"] = range;
203 imageset["color by scalar"] = "VON_MISES";
204
205 checkPhactoriStringValidParse(ImagesetRepresentationColorLegendMaximumRange, dj);
206 }
207
208 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationColorLegendPosition",
209 "[ImageSetRepresentationValid]")
210 {
211 Json::Value dj = getDefaultImageSetWithCameraJSON();
212
213 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
214 Json::Value position;
215 position[0] = "right";
216 position[1] = 0.5;
217 imageset["color legend position"] = position;
218 imageset["color by scalar"] = "VON_MISES";
219
220 checkPhactoriStringValidParse(ImagesetRepresentationColorLegendPosition, dj);
221 }
222
223 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationPresetColorScale",
224 "[ImageSetRepresentationValid]")
225 {
226 Json::Value dj = getDefaultImageSetWithCameraJSON();
227 Json::Value rep;
228 rep["color by tensor component"] = "stress_xy";
229 rep["preset color scale"] = "Blue_to_Red_Rainbow";
230 rep["invert color scale"] = true;
231 dj["representation blocks"]["BlueToRedRainbowInvertedRep"] = rep;
232
233 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
234 imageset["representation"] = "BlueToRedRainbowInvertedRep";
235 imageset["image basename"] = "BlueToRedRainbow.";
236 std::swap(dj["imageset blocks"]["BlueToRedRainbowInverted"], imageset);
237 dj["imageset blocks"].removeMember("fooImageset");
238
239 checkPhactoriStringValidParse(ImagesetRepresentationPresetColorScale, dj);
240 }
241
242 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationTimeAnnotationPosition",
243 "[ImageSetRepresentationValid]")
244 {
245 Json::Value dj = getDefaultImageSetWithCameraJSON();
246
247 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
248 Json::Value position;
249 position[0] = "top left";
250 position[1] = 0.5;
251 imageset["time annotation position"] = position;
252 imageset["show time annotation"] = true;
253
254 checkPhactoriStringValidParse(ImagesetRepresentationTimeAnnotationPosition, dj);
255 }
256
257 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetMultiColorBy", "[ImageSetRepresentationValid]")
258 {
259 Json::Value dj = getDefaultPhactoriJSON();
260
261 Json::Value camera;
262 camera["camera type"] = "camera";
263 camera["look direction"][0] = -1.0;
264 camera["look direction"][1] = -1.0;
265 camera["look direction"][2] = -1.0;
266 dj["camera blocks"]["singletestcamera"] = camera;
267
268 Json::Value is1;
269 is1["camera"] = "singletestcamera";
270 is1["image size"][0] = 800;
271 is1["image size"][1] = 450;
272
273 Json::Value is2(is1);
274 Json::Value is3(is1);
275 Json::Value is4(is1);
276 Json::Value is5(is1);
277
278 is1["image basename"] = "is1.";
279 is1["color by scalar"] = "VON_MISES";
280
281 is2["image basename"] = "is2.";
282 is2["color by tensor component"] = "stress_xy";
283
284 is3["image basename"] = "is3.";
285 is3["color by vector magnitude"] = "displ";
286
287 is4["image basename"] = "is4.";
288 Json::Value color;
289 color[0] = 0.1;
290 color[1] = 0.9;
291 color[2] = 0.95;
292 is4["color by solid color"] = color;
293
294 is5["image basename"] = "is5.";
295
296 dj["imageset blocks"]["is1"] = is1;
297 dj["imageset blocks"]["is2"] = is2;
298 dj["imageset blocks"]["is3"] = is3;
299 dj["imageset blocks"]["is4"] = is4;
300 dj["imageset blocks"]["is5"] = is5;
301
302 checkPhactoriStringValidParse(ImagesetMultiColorBy, dj);
303 }
304
305 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetAxesLegendOnOffMultiImageset",
306 "[ImageSetRepresentationValid]")
307 {
308 Json::Value dj = getDefaultPhactoriJSON();
309
310 Json::Value camera;
311 camera["camera type"] = "camera";
312 camera["look direction"][0] = -1.0;
313 camera["look direction"][1] = -1.0;
314 camera["look direction"][2] = -1.0;
315 dj["camera blocks"]["singletestcamera"] = camera;
316
317 Json::Value is1;
318 is1["camera"] = "singletestcamera";
319 is1["image size"][0] = 800;
320 is1["image size"][1] = 450;
321
322 Json::Value is2(is1);
323 Json::Value is3(is1);
324 Json::Value is4(is1);
325 Json::Value is5(is1);
326 Json::Value is6(is1);
327 Json::Value is7(is1);
328
329 is1["image basename"] = "is1.";
330 is1["color by scalar"] = "VON_MISES";
331 is1["show axes"] = true;
332 is1["show orientation axes"] = true;
333 is1["show time annotation"] = true;
334 is1["show edges"] = true;
335
336 is2["image basename"] = "is2.";
337 is2["color by tensor component"] = "stress_xy";
338 is2["show color legend"] = false;
339 is2["show orientation axes"] = false;
340
341 is3["image basename"] = "is3.";
342 is3["color by scalar"] = "VON_MISES";
343 is3["show color legend"] = true;
344 is3["show axes"] = true;
345
346 is4["image basename"] = "is4.";
347 is4["show axes"] = true;
348 is4["show edges"] = true;
349
350 is5["image basename"] = "is5.";
351 Json::Value color;
352 color[0] = 1.0;
353 color[1] = 0.5;
354 color[2] = 0.0;
355 is5["color by solid color"] = color;
356
357 is6["image basename"] = "is6.";
358 is6["show axes"] = true;
359 is6["show edges"] = true;
360 is6["show surfaces"] = false;
361
362 is7["image basename"] = "is7.";
363 Json::Value color2;
364 color2[0] = 0.0;
365 color2[1] = 1.0;
366 color2[2] = 1.0;
367 is7["color by solid color"] = color2;
368 is7["show axes"] = true;
369
370 dj["imageset blocks"]["is1"] = is1;
371 dj["imageset blocks"]["is2"] = is2;
372 dj["imageset blocks"]["is3"] = is3;
373 dj["imageset blocks"]["is4"] = is4;
374 dj["imageset blocks"]["is5"] = is5;
375 dj["imageset blocks"]["is6"] = is6;
376 dj["imageset blocks"]["is7"] = is7;
377
378 checkPhactoriStringValidParse(ImagesetAxesLegendOnOffMultiImageset, dj);
379 }
380
381 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationAxes", "[ImageSetRepresentationValid]")
382 {
383 Json::Value dj = getDefaultImageSetWithCameraJSON();
384
385 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
386 imageset["show axes"] = true;
387
388 checkPhactoriStringValidParse(ImagesetRepresentationAxes, dj);
389 }
390
391 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationAxisLabelName",
392 "[ImageSetRepresentationValid]")
393 {
394 Json::Value dj = getDefaultImageSetWithCameraJSON();
395
396 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
397 imageset["show axes"] = true;
398 imageset["x axis label name"] = "xAxis";
399 imageset["y axis label name"] = "yAxis";
400 imageset["z axis label name"] = "zAxis";
401
402 checkPhactoriStringValidParse(ImagesetRepresentationAxisLabelName, dj);
403 }
404
405 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationAxisLabel",
406 "[ImageSetRepresentationValid]")
407 {
408 Json::Value dj = getDefaultImageSetWithCameraJSON();
409
410 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
411 imageset["show axes"] = true;
412 imageset["show x axis label"] = false;
413 imageset["show y axis label"] = false;
414 imageset["show z axis label"] = false;
415
416 checkPhactoriStringValidParse(ImagesetRepresentationAxisLabel, dj);
417 }
418
419 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationAxisTicMarks",
420 "[ImageSetRepresentationValid]")
421 {
422 Json::Value dj = getDefaultImageSetWithCameraJSON();
423
424 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
425 imageset["show axes"] = true;
426 imageset["show x axis tic marks"] = false;
427 imageset["show y axis tic marks"] = false;
428 imageset["show z axis tic marks"] = false;
429
430 checkPhactoriStringValidParse(ImagesetRepresentationAxisTicMarks, dj);
431 }
432
433 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationAxisMinorTicMarks",
434 "[ImageSetRepresentationValid]")
435 {
436 Json::Value dj = getDefaultImageSetWithCameraJSON();
437
438 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
439 imageset["show axes"] = true;
440 imageset["show x axis minor tic marks"] = false;
441 imageset["show y axis minor tic marks"] = false;
442 imageset["show z axis minor tic marks"] = false;
443
444 checkPhactoriStringValidParse(ImagesetRepresentationAxisMinorTicMarks, dj);
445 }
446
447 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationAxisTicMarkLabels",
448 "[ImageSetRepresentationValid]")
449 {
450 Json::Value dj = getDefaultImageSetWithCameraJSON();
451
452 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
453 imageset["show axes"] = true;
454 imageset["show x axis tic mark labels"] = false;
455 imageset["show y axis tic mark labels"] = false;
456 imageset["show z axis tic mark labels"] = false;
457
458 checkPhactoriStringValidParse(ImagesetRepresentationAxisTicMarkLabels, dj);
459 }
460
461 TEST_CASE_METHOD(CatalystTestFixture, "ImagesetRepresentationOrientationAxes",
462 "[ImageSetRepresentationValid]")
463 {
464 Json::Value dj = getDefaultImageSetWithCameraJSON();
465
466 Json::Value &imageset = dj["imageset blocks"]["fooImageset"];
467 imageset["show orientation axes"] = true;
468
469 Json::Value fooImageset2(imageset);
470 fooImageset2["show orientation axes"] = false;
471 dj["imageset blocks"]["fooImageset2"] = fooImageset2;
472
473 checkPhactoriStringValidParse(ImagesetRepresentationOrientationAxes, dj);
474 }