MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / main

Function main

tests/test_images.cpp:68–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68int main(int argc, char **argv)
69{
70 if (config().parseOptions(argc, argv))
71 {
72 return EXIT_FAILURE;
73 }
74 std::map<UString, UString> testImages = {
75 // PCX files:
76 {"xcom3/ufodata/titles.pcx", "test_images/ufodata_titles.png"},
77 // RAW files:
78 {"RAW:xcom3/ufodata/isobord1.dat:640:128:xcom3/ufodata/pal_01.dat",
79 "test_images/ufodata_isobord1_pal01.png"},
80 // PCK files:
81 {"PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:30:xcom3/ufodata/base.pcx",
82 "test_images/ufodata_newbut_3_base_pcx.png"},
83 {"PCK:xcom3/ufodata/city.pck:xcom3/ufodata/city.tab:956:xcom3/ufodata/pal_01.dat",
84 "test_images/ufodata_city_956_pal01.png"},
85 {"PCK:xcom3/tacdata/unit/xcom1a.pck:xcom3/tacdata/unit/xcom1a.tab:30:xcom3/tacdata/"
86 "tactical.pal",
87 "test_images/tacdata_unit_xcom1a_30_tactical.png"},
88 {"PCK:xcom3/tacdata/unit/xcom1a.pck:xcom3/tacdata/unit/xcom1a.tab:240:xcom3/tacdata/"
89 "tactical.pal",
90 "test_images/tacdata_unit_xcom1a_240_tactical.png"},
91 {"PCK:xcom3/tacdata/unit/xcom1a.pck:xcom3/tacdata/unit/xcom1a.tab:134:xcom3/tacdata/"
92 "tactical.pal",
93 "test_images/tacdata_unit_xcom1a_134_tactical.png"},
94 // PCKSTRAT files:
95 {"PCKSTRAT:xcom3/ufodata/stratmap.pck:xcom3/ufodata/stratmap.tab:32:xcom3/ufodata/"
96 "pal_01.dat",
97 "test_images/ufodata_stratmap_32.png"},
98 // SHADOW files:
99 {"PCKSHADOW:xcom3/ufodata/shadow.pck:xcom3/ufodata/shadow.tab:5:xcom3/ufodata/pal_01.dat",
100 "test_images/ufodata_shadow_5.png"},
101 // LOFTEMPS files:
102 {"LOFTEMPS:xcom3/ufodata/loftemps.dat:xcom3/ufodata/loftemps.tab:113",
103 "test_images/ufodata_loftemps_113.png"},
104 {"LOFTEMPS:xcom3/ufodata/loftemps.dat:xcom3/ufodata/loftemps.tab:150",
105 "test_images/ufodata_loftemps_150.png"},
106 {"LOFTEMPS:xcom3/ufodata/loftemps.dat:xcom3/ufodata/loftemps.tab:151",
107 "test_images/ufodata_loftemps_151.png"},
108 };
109 Framework fw("OpenApoc", false);
110
111 for (auto &imagePair : testImages)
112 {
113 if (!testImage(imagePair.first, imagePair.second))
114 {
115 LogError("Image \"%s\" didn't match reference \"%s\"", imagePair.first,
116 imagePair.second);
117 return EXIT_FAILURE;
118 }
119 LogInfo("Image \"%s\" matches reference \"%s\"", imagePair.first, imagePair.second);
120 }
121
122 return EXIT_SUCCESS;
123}

Callers

nothing calls this directly

Calls 2

testImageFunction · 0.85
parseOptionsMethod · 0.45

Tested by

no test coverage detected