| 181 | /*extension=*/".png"))); |
| 182 | |
| 183 | TEST(ImageReaderTest, SingleCamera) { |
| 184 | auto database = Database::Open(kInMemorySqliteDatabasePath); |
| 185 | const auto test_dir = CreateTestDir(); |
| 186 | |
| 187 | ImageReaderOptions options; |
| 188 | options.image_path = test_dir / "images"; |
| 189 | options.single_camera = true; |
| 190 | CreateDirIfNotExists(options.image_path); |
| 191 | |
| 192 | // Create 3 test images with same dimensions |
| 193 | Bitmap test_bitmap(10, 20, true); |
| 194 | test_bitmap.Write(options.image_path / "0.png"); |
| 195 | test_bitmap.Write(options.image_path / "1.png"); |
| 196 | test_bitmap.Write(options.image_path / "2.png"); |
| 197 | |
| 198 | ImageReader image_reader(options, database.get()); |
| 199 | EXPECT_EQ(image_reader.NumImages(), 3); |
| 200 | |
| 201 | Rig rig; |
| 202 | Camera camera; |
| 203 | Image image; |
| 204 | PosePrior pose_prior; |
| 205 | Bitmap bitmap; |
| 206 | Bitmap mask; |
| 207 | |
| 208 | for (int i = 0; i < 3; ++i) { |
| 209 | const auto status = |
| 210 | image_reader.Next(&rig, &camera, &image, &pose_prior, &bitmap, &mask); |
| 211 | ASSERT_EQ(status, ImageReader::Status::SUCCESS); |
| 212 | } |
| 213 | |
| 214 | EXPECT_EQ(database->NumRigs(), 1); |
| 215 | EXPECT_EQ(database->NumCameras(), 1); |
| 216 | } |
| 217 | |
| 218 | TEST(ImageReaderTest, SingleCameraDimensionError) { |
| 219 | auto database = Database::Open(kInMemorySqliteDatabasePath); |
nothing calls this directly
no test coverage detected