@@ -180,3 +180,56 @@ TEST_CASE("Create image pyramid with custom level sizes", "[fast][ImagePyramid]"
180180 CHECK (pyramid->getLevelScale (1 ) == Approx (1 .5f ).margin (0.01 ));
181181 CHECK (pyramid->getLevelScale (2 ) == Approx (4 .5f ).margin (0.01 ));
182182}
183+
184+ TEST_CASE (" Create image pyramid with custom level sizes including level 0" , " [fast][ImagePyramid]" ) {
185+ std::vector<Vector2i> sizes = {
186+ {22000 , 13000 },
187+ {22000 /1 .5f , 13000 /1 .5f },
188+ {22000 /4 .5f , 13000 /4 .5f }
189+ };
190+ auto pyramid = ImagePyramid::create (22000 , 13000 , 1 , 512 , 512 , ImageCompression::JPEG, 90 ,
191+ fast::TYPE_UINT8, {}, sizes);
192+
193+ CHECK (pyramid->getNrOfLevels () == 3 );
194+ CHECK (pyramid->getWidth () == 22000 );
195+ CHECK (pyramid->getHeight () == 13000 );
196+ CHECK (pyramid->getLevelWidth (1 ) == sizes[1 ].x ());
197+ CHECK (pyramid->getLevelHeight (1 ) == sizes[1 ].y ());
198+ CHECK (pyramid->getLevelWidth (2 ) == sizes[2 ].x ());
199+ CHECK (pyramid->getLevelHeight (2 ) == sizes[2 ].y ());
200+ CHECK_THROWS (pyramid->getLevelWidth (3 ));
201+ CHECK (pyramid->getDataType () == TYPE_UINT8);
202+ CHECK (pyramid->getLevelTileWidth (0 ) == 512 );
203+ CHECK (pyramid->getLevelTileHeight (0 ) == 512 );
204+ CHECK (pyramid->getCompression () == ImageCompression::JPEG);
205+ CHECK (pyramid->getNrOfChannels () == 1 );
206+ CHECK (pyramid->getLevelScale (0 ) == Approx (1 .0f ).margin (0.01 ));
207+ CHECK (pyramid->getLevelScale (1 ) == Approx (1 .5f ).margin (0.01 ));
208+ CHECK (pyramid->getLevelScale (2 ) == Approx (4 .5f ).margin (0.01 ));
209+ }
210+
211+ TEST_CASE (" Invalid level sizes" , " [fast][ImagePyramid]" ) {
212+ std::vector<Vector2i> sizes = {
213+ {24000 , 13000 },
214+ {128 , 128 }
215+ };
216+ CHECK_THROWS (
217+ auto pyramid = ImagePyramid::create (22000 , 13000 , 1 , 512 , 512 , ImageCompression::JPEG, 90 ,
218+ fast::TYPE_UINT8, {}, sizes);
219+ );
220+
221+ }
222+
223+ TEST_CASE (" getLevelSizes" , " [fast][ImagePyramid]" ) {
224+ std::vector<Vector2i> sizes = {
225+ {22000 , 13000 },
226+ {22000 /1 .5f , 13000 /1 .5f },
227+ {22000 /4 .5f , 13000 /4 .5f }
228+ };
229+ auto pyramid = ImagePyramid::create (22000 , 13000 , 1 , 512 , 512 , ImageCompression::JPEG, 90 ,
230+ fast::TYPE_UINT8, {}, sizes);
231+ auto levelSizes = pyramid->getLevelSizes ();
232+ for (int i = 0 ; i < 3 ; ++i) {
233+ CHECK (levelSizes[i] == sizes[i]);
234+ }
235+ }
0 commit comments