1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #define private public 17 #include <gtest/gtest.h> 18 #include "buffer_source_stream.h" 19 #include "exif_info.h" 20 #include "image_packer.h" 21 #include "jpeg_decoder.h" 22 #include "mock_data_stream.h" 23 24 using namespace testing::ext; 25 using namespace OHOS::Media; 26 namespace OHOS { 27 namespace ImagePlugin { 28 static constexpr size_t STREAM_SIZE = 1000; 29 const std::string ORIENTATION = "Orientation"; 30 const std::string IMAGE_LENGTH = "ImageLength"; 31 const std::string SCENE_TYPE = "SceneType"; 32 const std::string COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel"; 33 const std::string DATE_TIME = "DateTime"; 34 const std::string GPS_TIME_STAMP = "GPSTimeStamp"; 35 const std::string GPS_DATE_STAMP = "GPSDateStamp"; 36 const std::string IMAGE_DESCRIPTION = "ImageDescription"; 37 const std::string MAKE = "Make"; 38 const std::string MODEL = "Model"; 39 const std::string PHOTO_MODE = "PhotoMode"; 40 const std::string SENSITIVITY_TYPE = "SensitivityType"; 41 const std::string STANDARD_OUTPUT_SENSITIVITY = "StandardOutputSensitivity"; 42 const std::string RECOMMENDED_EXPOSURE_INDEX = "RecommendedExposureIndex"; 43 const std::string ISO_SPEED = "ISOSpeedRatings"; 44 const std::string APERTURE_VALUE = "ApertureValue"; 45 const std::string EXPOSURE_BIAS_VALUE = "ExposureBiasValue"; 46 const std::string METERING_MODE = "MeteringMode"; 47 const std::string LIGHT_SOURCE = "LightSource"; 48 const std::string FLASH = "Flash"; 49 const std::string FOCAL_LENGTH = "FocalLength"; 50 const std::string USER_COMMENT = "UserComment"; 51 const std::string PIXEL_X_DIMENSION = "PixelXDimension"; 52 const std::string PIXEL_Y_DIMENSION = "PixelYDimension"; 53 const std::string WHITE_BALANCE = "WhiteBalance"; 54 const std::string FOCAL_LENGTH_IN_35_MM_FILM = "FocalLengthIn35mmFilm"; 55 const std::string HW_MNOTE_CAPTURE_MODE = "HwMnoteCaptureMode"; 56 const std::string HW_MNOTE_PHYSICAL_APERTURE = "HwMnotePhysicalAperture"; 57 class JpegDecoderTest : public testing::Test { 58 public: JpegDecoderTest()59 JpegDecoderTest() {} ~JpegDecoderTest()60 ~JpegDecoderTest() {} 61 }; 62 63 /** 64 * @tc.name: GetImagePropertyStringTest016 65 * @tc.desc: Test of GetImagePropertyString 66 * @tc.type: FUNC 67 */ 68 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest016, TestSize.Level3) 69 { 70 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest016 start"; 71 auto jpegDecoder = std::make_shared<JpegDecoder>(); 72 int size = STREAM_SIZE; 73 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 74 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 75 jpegDecoder->SetSource(*streamPtr.release()); 76 std::string key = COMPRESSED_BITS_PER_PIXEL; 77 std::string value = ""; 78 EXIFInfo exifInfo_; 79 jpegDecoder->GetImagePropertyString(0, key, value); 80 ASSERT_EQ(value, exifInfo_.compressedBitsPerPixel_); 81 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest016 end"; 82 } 83 84 /** 85 * @tc.name: GetImagePropertyStringTest017 86 * @tc.desc: Test of GetImagePropertyString 87 * @tc.type: FUNC 88 */ 89 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest017, TestSize.Level3) 90 { 91 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest017 start"; 92 auto jpegDecoder = std::make_shared<JpegDecoder>(); 93 int size = STREAM_SIZE; 94 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 95 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 96 jpegDecoder->SetSource(*streamPtr.release()); 97 std::string key = DATE_TIME; 98 std::string value = ""; 99 EXIFInfo exifInfo_; 100 jpegDecoder->GetImagePropertyString(0, key, value); 101 ASSERT_EQ(value, exifInfo_.dateTime_); 102 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest017 end"; 103 } 104 105 /** 106 * @tc.name: GetImagePropertyStringTest018 107 * @tc.desc: Test of GetImagePropertyString 108 * @tc.type: FUNC 109 */ 110 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest018, TestSize.Level3) 111 { 112 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest018 start"; 113 auto jpegDecoder = std::make_shared<JpegDecoder>(); 114 int size = STREAM_SIZE; 115 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 116 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 117 jpegDecoder->SetSource(*streamPtr.release()); 118 std::string key = GPS_TIME_STAMP; 119 std::string value = ""; 120 EXIFInfo exifInfo_; 121 jpegDecoder->GetImagePropertyString(0, key, value); 122 ASSERT_EQ(value, exifInfo_.gpsTimeStamp_); 123 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest018 end"; 124 } 125 126 /** 127 * @tc.name: GetImagePropertyStringTest019 128 * @tc.desc: Test of GetImagePropertyString 129 * @tc.type: FUNC 130 */ 131 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest019, TestSize.Level3) 132 { 133 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest019 start"; 134 auto jpegDecoder = std::make_shared<JpegDecoder>(); 135 int size = STREAM_SIZE; 136 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 137 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 138 jpegDecoder->SetSource(*streamPtr.release()); 139 std::string key = GPS_DATE_STAMP; 140 std::string value = ""; 141 EXIFInfo exifInfo_; 142 jpegDecoder->GetImagePropertyString(0, key, value); 143 ASSERT_EQ(value, exifInfo_.gpsDateStamp_); 144 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest019 end"; 145 } 146 147 /** 148 * @tc.name: GetImagePropertyStringTest020 149 * @tc.desc: Test of GetImagePropertyString 150 * @tc.type: FUNC 151 */ 152 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest020, TestSize.Level3) 153 { 154 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest020 start"; 155 auto jpegDecoder = std::make_shared<JpegDecoder>(); 156 int size = STREAM_SIZE; 157 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 158 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 159 jpegDecoder->SetSource(*streamPtr.release()); 160 std::string key = IMAGE_DESCRIPTION; 161 std::string value = ""; 162 EXIFInfo exifInfo_; 163 jpegDecoder->GetImagePropertyString(0, key, value); 164 ASSERT_EQ(value, exifInfo_.imageDescription_); 165 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest020 end"; 166 } 167 168 /** 169 * @tc.name: GetImagePropertyStringTest021 170 * @tc.desc: Test of GetImagePropertyString 171 * @tc.type: FUNC 172 */ 173 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest021, TestSize.Level3) 174 { 175 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest021 start"; 176 auto jpegDecoder = std::make_shared<JpegDecoder>(); 177 int size = STREAM_SIZE; 178 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 179 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 180 jpegDecoder->SetSource(*streamPtr.release()); 181 std::string key = MAKE; 182 std::string value = ""; 183 EXIFInfo exifInfo_; 184 jpegDecoder->GetImagePropertyString(0, key, value); 185 ASSERT_EQ(value, exifInfo_.make_); 186 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest021 end"; 187 } 188 189 /** 190 * @tc.name: GetImagePropertyStringTest022 191 * @tc.desc: Test of GetImagePropertyString 192 * @tc.type: FUNC 193 */ 194 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest022, TestSize.Level3) 195 { 196 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest022 start"; 197 auto jpegDecoder = std::make_shared<JpegDecoder>(); 198 int size = STREAM_SIZE; 199 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 200 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 201 jpegDecoder->SetSource(*streamPtr.release()); 202 std::string key = MODEL; 203 std::string value = ""; 204 EXIFInfo exifInfo_; 205 jpegDecoder->GetImagePropertyString(0, key, value); 206 ASSERT_EQ(value, exifInfo_.model_); 207 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest022 end"; 208 } 209 210 /** 211 * @tc.name: GetImagePropertyStringTest023 212 * @tc.desc: Test of GetImagePropertyString 213 * @tc.type: FUNC 214 */ 215 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest023, TestSize.Level3) 216 { 217 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest023 start"; 218 auto jpegDecoder = std::make_shared<JpegDecoder>(); 219 int size = STREAM_SIZE; 220 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 221 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 222 jpegDecoder->SetSource(*streamPtr.release()); 223 std::string key = PHOTO_MODE; 224 std::string value = ""; 225 EXIFInfo exifInfo_; 226 jpegDecoder->GetImagePropertyString(0, key, value); 227 ASSERT_EQ(value, exifInfo_.photoMode_); 228 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest023 end"; 229 } 230 231 /** 232 * @tc.name: GetImagePropertyStringTest024 233 * @tc.desc: Test of GetImagePropertyString 234 * @tc.type: FUNC 235 */ 236 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest024, TestSize.Level3) 237 { 238 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest024 start"; 239 auto jpegDecoder = std::make_shared<JpegDecoder>(); 240 int size = STREAM_SIZE; 241 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 242 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 243 jpegDecoder->SetSource(*streamPtr.release()); 244 std::string key = SENSITIVITY_TYPE; 245 std::string value = ""; 246 EXIFInfo exifInfo_; 247 jpegDecoder->GetImagePropertyString(0, key, value); 248 ASSERT_EQ(value, exifInfo_.sensitivityType_); 249 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest024 end"; 250 } 251 252 /** 253 * @tc.name: GetImagePropertyStringTest025 254 * @tc.desc: Test of GetImagePropertyString 255 * @tc.type: FUNC 256 */ 257 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest025, TestSize.Level3) 258 { 259 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest025 start"; 260 auto jpegDecoder = std::make_shared<JpegDecoder>(); 261 int size = STREAM_SIZE; 262 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 263 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 264 jpegDecoder->SetSource(*streamPtr.release()); 265 std::string key = STANDARD_OUTPUT_SENSITIVITY; 266 std::string value = ""; 267 EXIFInfo exifInfo_; 268 jpegDecoder->GetImagePropertyString(0, key, value); 269 ASSERT_EQ(value, exifInfo_.standardOutputSensitivity_); 270 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest025 end"; 271 } 272 273 /** 274 * @tc.name: GetImagePropertyStringTest026 275 * @tc.desc: Test of GetImagePropertyString 276 * @tc.type: FUNC 277 */ 278 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest026, TestSize.Level3) 279 { 280 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest026 start"; 281 auto jpegDecoder = std::make_shared<JpegDecoder>(); 282 int size = STREAM_SIZE; 283 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 284 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 285 jpegDecoder->SetSource(*streamPtr.release()); 286 std::string key = RECOMMENDED_EXPOSURE_INDEX; 287 std::string value = ""; 288 EXIFInfo exifInfo_; 289 jpegDecoder->GetImagePropertyString(0, key, value); 290 ASSERT_EQ(value, exifInfo_.recommendedExposureIndex_); 291 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest026 end"; 292 } 293 294 /** 295 * @tc.name: GetImagePropertyStringTest027 296 * @tc.desc: Test of GetImagePropertyString 297 * @tc.type: FUNC 298 */ 299 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest027, TestSize.Level3) 300 { 301 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest027 start"; 302 auto jpegDecoder = std::make_shared<JpegDecoder>(); 303 int size = STREAM_SIZE; 304 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 305 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 306 jpegDecoder->SetSource(*streamPtr.release()); 307 std::string key = APERTURE_VALUE; 308 std::string value = ""; 309 EXIFInfo exifInfo_; 310 jpegDecoder->GetImagePropertyString(0, key, value); 311 ASSERT_EQ(value, exifInfo_.apertureValue_); 312 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest027 end"; 313 } 314 315 /** 316 * @tc.name: GetImagePropertyStringTest028 317 * @tc.desc: Test of GetImagePropertyString 318 * @tc.type: FUNC 319 */ 320 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest028, TestSize.Level3) 321 { 322 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest028 start"; 323 auto jpegDecoder = std::make_shared<JpegDecoder>(); 324 int size = STREAM_SIZE; 325 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 326 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 327 jpegDecoder->SetSource(*streamPtr.release()); 328 std::string key = EXPOSURE_BIAS_VALUE; 329 std::string value = ""; 330 EXIFInfo exifInfo_; 331 jpegDecoder->GetImagePropertyString(0, key, value); 332 ASSERT_EQ(value, exifInfo_.exposureBiasValue_); 333 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest028 end"; 334 } 335 336 /** 337 * @tc.name: GetImagePropertyStringTest029 338 * @tc.desc: Test of GetImagePropertyString 339 * @tc.type: FUNC 340 */ 341 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest029, TestSize.Level3) 342 { 343 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest029 start"; 344 auto jpegDecoder = std::make_shared<JpegDecoder>(); 345 int size = STREAM_SIZE; 346 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 347 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 348 jpegDecoder->SetSource(*streamPtr.release()); 349 std::string key = METERING_MODE; 350 std::string value = ""; 351 EXIFInfo exifInfo_; 352 jpegDecoder->GetImagePropertyString(0, key, value); 353 ASSERT_EQ(value, exifInfo_.meteringMode_); 354 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest029 end"; 355 } 356 357 /** 358 * @tc.name: GetImagePropertyStringTest030 359 * @tc.desc: Test of GetImagePropertyString 360 * @tc.type: FUNC 361 */ 362 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest030, TestSize.Level3) 363 { 364 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest030 start"; 365 auto jpegDecoder = std::make_shared<JpegDecoder>(); 366 int size = STREAM_SIZE; 367 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 368 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 369 jpegDecoder->SetSource(*streamPtr.release()); 370 std::string key = LIGHT_SOURCE; 371 std::string value = ""; 372 EXIFInfo exifInfo_; 373 jpegDecoder->GetImagePropertyString(0, key, value); 374 ASSERT_EQ(value, exifInfo_.lightSource_); 375 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest030 end"; 376 } 377 378 /** 379 * @tc.name: GetImagePropertyStringTest031 380 * @tc.desc: Test of GetImagePropertyString 381 * @tc.type: FUNC 382 */ 383 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest031, TestSize.Level3) 384 { 385 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest031 start"; 386 auto jpegDecoder = std::make_shared<JpegDecoder>(); 387 int size = STREAM_SIZE; 388 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 389 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 390 jpegDecoder->SetSource(*streamPtr.release()); 391 std::string key = FLASH; 392 std::string value = ""; 393 EXIFInfo exifInfo_; 394 jpegDecoder->GetImagePropertyString(0, key, value); 395 ASSERT_EQ(value, exifInfo_.flash_); 396 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest031 end"; 397 } 398 399 /** 400 * @tc.name: GetImagePropertyStringTest032 401 * @tc.desc: Test of GetImagePropertyString 402 * @tc.type: FUNC 403 */ 404 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest032, TestSize.Level3) 405 { 406 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest032 start"; 407 auto jpegDecoder = std::make_shared<JpegDecoder>(); 408 int size = STREAM_SIZE; 409 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 410 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 411 jpegDecoder->SetSource(*streamPtr.release()); 412 std::string key = FOCAL_LENGTH; 413 std::string value = ""; 414 EXIFInfo exifInfo_; 415 jpegDecoder->GetImagePropertyString(0, key, value); 416 ASSERT_EQ(value, exifInfo_.focalLength_); 417 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest032 end"; 418 } 419 420 /** 421 * @tc.name: GetImagePropertyStringTest033 422 * @tc.desc: Test of GetImagePropertyString 423 * @tc.type: FUNC 424 */ 425 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest033, TestSize.Level3) 426 { 427 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest033 start"; 428 auto jpegDecoder = std::make_shared<JpegDecoder>(); 429 int size = STREAM_SIZE; 430 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 431 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 432 jpegDecoder->SetSource(*streamPtr.release()); 433 std::string key = USER_COMMENT; 434 std::string value = ""; 435 EXIFInfo exifInfo_; 436 jpegDecoder->GetImagePropertyString(0, key, value); 437 ASSERT_EQ(value, exifInfo_.userComment_); 438 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest033 end"; 439 } 440 441 /** 442 * @tc.name: GetImagePropertyStringTest034 443 * @tc.desc: Test of GetImagePropertyString 444 * @tc.type: FUNC 445 */ 446 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest034, TestSize.Level3) 447 { 448 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest034 start"; 449 auto jpegDecoder = std::make_shared<JpegDecoder>(); 450 int size = STREAM_SIZE; 451 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 452 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 453 jpegDecoder->SetSource(*streamPtr.release()); 454 std::string key = PIXEL_X_DIMENSION; 455 std::string value = ""; 456 EXIFInfo exifInfo_; 457 jpegDecoder->GetImagePropertyString(0, key, value); 458 ASSERT_EQ(value, exifInfo_.pixelXDimension_); 459 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest034 end"; 460 } 461 462 /** 463 * @tc.name: GetImagePropertyStringTest035 464 * @tc.desc: Test of GetImagePropertyString 465 * @tc.type: FUNC 466 */ 467 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest035, TestSize.Level3) 468 { 469 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest035 start"; 470 auto jpegDecoder = std::make_shared<JpegDecoder>(); 471 int size = STREAM_SIZE; 472 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 473 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 474 jpegDecoder->SetSource(*streamPtr.release()); 475 std::string key = PIXEL_Y_DIMENSION; 476 std::string value = ""; 477 EXIFInfo exifInfo_; 478 jpegDecoder->GetImagePropertyString(0, key, value); 479 ASSERT_EQ(value, exifInfo_.pixelYDimension_); 480 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest035 end"; 481 } 482 483 /** 484 * @tc.name: GetImagePropertyStringTest036 485 * @tc.desc: Test of GetImagePropertyString 486 * @tc.type: FUNC 487 */ 488 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest036, TestSize.Level3) 489 { 490 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest036 start"; 491 auto jpegDecoder = std::make_shared<JpegDecoder>(); 492 int size = STREAM_SIZE; 493 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 494 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 495 jpegDecoder->SetSource(*streamPtr.release()); 496 std::string key = WHITE_BALANCE; 497 std::string value = ""; 498 EXIFInfo exifInfo_; 499 jpegDecoder->GetImagePropertyString(0, key, value); 500 ASSERT_EQ(value, exifInfo_.whiteBalance_); 501 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest036 end"; 502 } 503 504 /** 505 * @tc.name: GetImagePropertyStringTest037 506 * @tc.desc: Test of GetImagePropertyString 507 * @tc.type: FUNC 508 */ 509 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest037, TestSize.Level3) 510 { 511 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest037 start"; 512 auto jpegDecoder = std::make_shared<JpegDecoder>(); 513 int size = STREAM_SIZE; 514 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 515 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 516 jpegDecoder->SetSource(*streamPtr.release()); 517 std::string key = FOCAL_LENGTH_IN_35_MM_FILM; 518 std::string value = ""; 519 EXIFInfo exifInfo_; 520 jpegDecoder->GetImagePropertyString(0, key, value); 521 ASSERT_EQ(value, exifInfo_.focalLengthIn35mmFilm_); 522 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest037 end"; 523 } 524 525 /** 526 * @tc.name: GetImagePropertyStringTest038 527 * @tc.desc: Test of GetImagePropertyString 528 * @tc.type: FUNC 529 */ 530 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest038, TestSize.Level3) 531 { 532 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest038 start"; 533 auto jpegDecoder = std::make_shared<JpegDecoder>(); 534 int size = STREAM_SIZE; 535 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 536 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 537 jpegDecoder->SetSource(*streamPtr.release()); 538 std::string key = HW_MNOTE_CAPTURE_MODE; 539 std::string value = ""; 540 EXIFInfo exifInfo_; 541 jpegDecoder->GetImagePropertyString(0, key, value); 542 ASSERT_EQ(value, exifInfo_.hwMnoteCaptureMode_); 543 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest038 end"; 544 } 545 546 /** 547 * @tc.name: GetImagePropertyStringTest039 548 * @tc.desc: Test of GetImagePropertyString 549 * @tc.type: FUNC 550 */ 551 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest039, TestSize.Level3) 552 { 553 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest039 start"; 554 auto jpegDecoder = std::make_shared<JpegDecoder>(); 555 int size = STREAM_SIZE; 556 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 557 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 558 jpegDecoder->SetSource(*streamPtr.release()); 559 std::string key = HW_MNOTE_PHYSICAL_APERTURE; 560 std::string value = ""; 561 EXIFInfo exifInfo_; 562 jpegDecoder->GetImagePropertyString(0, key, value); 563 ASSERT_EQ(value, exifInfo_.hwMnotePhysicalAperture_); 564 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest039 end"; 565 } 566 567 /** 568 * @tc.name: GetImagePropertyStringTest040 569 * @tc.desc: Test of GetImagePropertyString 570 * @tc.type: FUNC 571 */ 572 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest040, TestSize.Level3) 573 { 574 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest040 start"; 575 auto jpegDecoder = std::make_shared<JpegDecoder>(); 576 int size = STREAM_SIZE; 577 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 578 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 579 jpegDecoder->SetSource(*streamPtr.release()); 580 std::string key = ISO_SPEED; 581 std::string value = ""; 582 EXIFInfo exifInfo_; 583 jpegDecoder->GetImagePropertyString(0, key, value); 584 ASSERT_EQ(value, exifInfo_.isoSpeedRatings_); 585 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest040 end"; 586 } 587 588 /** 589 * @tc.name: SetSourceTest001 590 * @tc.desc: Test of SetSource 591 * @tc.type: FUNC 592 */ 593 HWTEST_F(JpegDecoderTest, SetSourceTest001, TestSize.Level3) 594 { 595 GTEST_LOG_(INFO) << "JpegDecoderTest: SetSourceTest001 start"; 596 auto jpegDecoder = std::make_shared<JpegDecoder>(); 597 int size = STREAM_SIZE; 598 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 599 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 600 jpegDecoder->SetSource(*streamPtr.release()); 601 bool result = (jpegDecoder != nullptr); 602 ASSERT_EQ(result, true); 603 GTEST_LOG_(INFO) << "JpegDecoderTest: SetSourceTest001 end"; 604 } 605 606 /** 607 * @tc.name: SetDecodeOptionsTest001 608 * @tc.desc: Test of SetDecodeOptions 609 * @tc.type: FUNC 610 */ 611 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest001, TestSize.Level3) 612 { 613 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest001 start"; 614 auto jpegDecoder = std::make_shared<JpegDecoder>(); 615 auto mock = std::make_shared<MockInputDataStream>(); 616 mock->SetReturn(false); 617 jpegDecoder->SetSource(*mock.get()); 618 PixelDecodeOptions opts; 619 PlImageInfo info; 620 // goto : return ret 621 uint32_t result = jpegDecoder->SetDecodeOptions(0, opts, info); 622 ASSERT_EQ(result, ERR_IMAGE_SOURCE_DATA_INCOMPLETE); 623 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest001 end"; 624 } 625 626 /** 627 * @tc.name: SetDecodeOptionsTest002 628 * @tc.desc: Test of SetDecodeOptions 629 * @tc.type: FUNC 630 */ 631 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest002, TestSize.Level3) 632 { 633 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest002 start"; 634 auto jpegDecoder = std::make_shared<JpegDecoder>(); 635 int size = STREAM_SIZE; 636 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 637 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 638 jpegDecoder->SetSource(*streamPtr.release()); 639 PixelDecodeOptions opts; 640 PlImageInfo info; 641 uint32_t result = jpegDecoder->SetDecodeOptions(JPEG_IMAGE_NUM, opts, info); 642 ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER); 643 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest002 end"; 644 } 645 646 /** 647 * @tc.name: SetDecodeOptionsTest003 648 * @tc.desc: Test of SetDecodeOptions 649 * @tc.type: FUNC 650 */ 651 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest003, TestSize.Level3) 652 { 653 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest003 start"; 654 auto jpegDecoder = std::make_shared<JpegDecoder>(); 655 auto mock = std::make_shared<MockInputDataStream>(); 656 mock->SetReturn(false); 657 jpegDecoder->SetSource(*mock.get()); 658 PixelDecodeOptions opts; 659 PlImageInfo info; 660 uint32_t result = jpegDecoder->SetDecodeOptions(0, opts, info); 661 // goto DecoderHeader return ERR_IMAGE_SOURCE_DATA_INCOMPLETE 662 ASSERT_EQ(result, ERR_IMAGE_SOURCE_DATA_INCOMPLETE); 663 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest003 end"; 664 } 665 666 /** 667 * @tc.name: SetDecodeOptionsTest004 668 * @tc.desc: Test of SetDecodeOptions 669 * @tc.type: FUNC 670 */ 671 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest004, TestSize.Level3) 672 { 673 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest004 start"; 674 auto jpegDecoder = std::make_shared<JpegDecoder>(); 675 auto mock = std::make_shared<MockInputDataStream>(); 676 mock->SetReturn(false); 677 jpegDecoder->SetSource(*mock.get()); 678 PixelDecodeOptions opts; 679 PlImageInfo info; 680 uint32_t result = jpegDecoder->SetDecodeOptions(1, opts, info); 681 ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER); 682 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest004 end"; 683 } 684 685 /** 686 * @tc.name: SetDecodeOptionsTest005 687 * @tc.desc: Test of SetDecodeOptions 688 * @tc.type: FUNC 689 */ 690 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest005, TestSize.Level3) 691 { 692 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest005 start"; 693 auto jpegDecoder = std::make_shared<JpegDecoder>(); 694 PixelDecodeOptions opts; 695 PlImageInfo info; 696 uint32_t result = jpegDecoder->SetDecodeOptions(0, opts, info); 697 // goto DecoderHeader return ERR_IMAGE_SOURCE_DATA_INCOMPLETE 698 ASSERT_EQ(result, ERR_MEDIA_INVALID_OPERATION); 699 GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest005 end"; 700 } 701 702 /** 703 * @tc.name: GetImageSizeTest001 704 * @tc.desc: Test of GetImageSize 705 * @tc.type: FUNC 706 */ 707 HWTEST_F(JpegDecoderTest, GetImageSizeTest001, TestSize.Level3) 708 { 709 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest001 start"; 710 auto jpegDecoder = std::make_shared<JpegDecoder>(); 711 auto mock = std::make_shared<MockInputDataStream>(); 712 mock->SetReturn(false); 713 jpegDecoder->SetSource(*mock.get()); 714 ImagePlugin::Size plSize; 715 uint32_t result = jpegDecoder->GetImageSize(0, plSize); 716 // goto DecodeHeader return ERR_IMAGE_SOURCE_DATA_INCOMPLETE 717 ASSERT_EQ(result, ERR_IMAGE_SOURCE_DATA_INCOMPLETE); 718 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest001 end"; 719 } 720 721 /** 722 * @tc.name: GetImageSizeTest002 723 * @tc.desc: Test of GetImageSize 724 * @tc.type: FUNC 725 */ 726 HWTEST_F(JpegDecoderTest, GetImageSizeTest002, TestSize.Level3) 727 { 728 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest002 start"; 729 auto jpegDecoder = std::make_shared<JpegDecoder>(); 730 int size = STREAM_SIZE; 731 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 732 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 733 ImagePlugin::Size plSize; 734 uint32_t result = jpegDecoder->GetImageSize(0, plSize); 735 // goto DecodeHeader return ERR_IMAGE_DECODE_ABNORMAL 736 ASSERT_EQ(result, ERR_MEDIA_INVALID_OPERATION); 737 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest002 end"; 738 } 739 740 /** 741 * @tc.name: GetImageSizeTest004 742 * @tc.desc: Test of GetImageSize 743 * @tc.type: FUNC 744 */ 745 HWTEST_F(JpegDecoderTest, GetImageSizeTest004, TestSize.Level3) 746 { 747 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest004 start"; 748 auto jpegDecoder = std::make_shared<JpegDecoder>(); 749 int size = STREAM_SIZE; 750 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 751 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 752 ImagePlugin::Size plSize; 753 jpegDecoder->SetSource(*streamPtr.release()); 754 // check input parameter, index = JPEG_IMAGE_NUM 755 uint32_t result = jpegDecoder->GetImageSize(JPEG_IMAGE_NUM, plSize); 756 ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER); 757 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest004 end"; 758 } 759 760 /** 761 * @tc.name: DecodeTest001 762 * @tc.desc: Test of Decode 763 * @tc.type: FUNC 764 */ 765 HWTEST_F(JpegDecoderTest, DecodeTest001, TestSize.Level3) 766 { 767 GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest001 start"; 768 auto jpegDecoder = std::make_shared<JpegDecoder>(); 769 int size = STREAM_SIZE; 770 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 771 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 772 jpegDecoder->SetSource(*streamPtr.release()); 773 DecodeContext context; 774 uint32_t result = jpegDecoder->Decode(0, context); 775 ASSERT_EQ(result, ERR_MEDIA_INVALID_OPERATION); 776 GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest001 end"; 777 } 778 779 /** 780 * @tc.name: DecodeTest002 781 * @tc.desc: Test of Decode 782 * @tc.type: FUNC 783 */ 784 HWTEST_F(JpegDecoderTest, DecodeTest002, TestSize.Level3) 785 { 786 GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest002 start"; 787 auto jpegDecoder = std::make_shared<JpegDecoder>(); 788 int size = STREAM_SIZE; 789 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 790 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 791 jpegDecoder->SetSource(*streamPtr.release()); 792 DecodeContext context; 793 uint32_t result = jpegDecoder->Decode(JPEG_IMAGE_NUM, context); 794 ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER); 795 GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest002 end"; 796 } 797 798 /** 799 * @tc.name: GetImagePropertyIntTest001 800 * @tc.desc: Test of GetImagePropertyInt 801 * @tc.type: FUNC 802 */ 803 HWTEST_F(JpegDecoderTest, GetImagePropertyIntTest001, TestSize.Level3) 804 { 805 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest001 start"; 806 auto jpegDecoder = std::make_shared<JpegDecoder>(); 807 int size = STREAM_SIZE; 808 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 809 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 810 jpegDecoder->SetSource(*streamPtr.release()); 811 std::string key = "Orientation"; 812 int32_t value = 0; 813 uint32_t result = jpegDecoder->GetImagePropertyInt(0, key, value); 814 ASSERT_EQ(result, Media::ERR_MEDIA_VALUE_INVALID); 815 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest001 end"; 816 } 817 818 /** 819 * @tc.name: GetImagePropertyIntTest002 820 * @tc.desc: Test of GetImagePropertyInt 821 * @tc.type: FUNC 822 */ 823 HWTEST_F(JpegDecoderTest, GetImagePropertyIntTest002, TestSize.Level3) 824 { 825 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest002 start"; 826 auto jpegDecoder = std::make_shared<JpegDecoder>(); 827 int size = STREAM_SIZE; 828 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 829 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 830 jpegDecoder->SetSource(*streamPtr.release()); 831 std::string key = "ImageLength"; 832 int32_t value = 0; 833 uint32_t result = jpegDecoder->GetImagePropertyInt(0, key, value); 834 ASSERT_EQ(result, Media::ERR_MEDIA_VALUE_INVALID); 835 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest002 end"; 836 } 837 838 /** 839 * @tc.name: GetImagePropertyIntTest003 840 * @tc.desc: Test of GetImagePropertyInt 841 * @tc.type: FUNC 842 */ 843 HWTEST_F(JpegDecoderTest, GetImagePropertyIntTest003, TestSize.Level3) 844 { 845 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest003 start"; 846 auto jpegDecoder = std::make_shared<JpegDecoder>(); 847 int size = STREAM_SIZE; 848 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 849 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 850 jpegDecoder->SetSource(*streamPtr.release()); 851 std::string key = ACTUAL_IMAGE_ENCODED_FORMAT; 852 int32_t value = 0; 853 uint32_t result = jpegDecoder->GetImagePropertyInt(0, key, value); 854 ASSERT_EQ(result, Media::ERR_MEDIA_VALUE_INVALID); 855 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest003 end"; 856 } 857 858 /** 859 * @tc.name: GetImagePropertyStringTest001 860 * @tc.desc: Test of GetImagePropertyString 861 * @tc.type: FUNC 862 */ 863 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest001, TestSize.Level3) 864 { 865 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest001 start"; 866 auto jpegDecoder = std::make_shared<JpegDecoder>(); 867 int size = STREAM_SIZE; 868 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 869 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 870 jpegDecoder->SetSource(*streamPtr.release()); 871 std::string key = "BitsPerSample"; 872 std::string value = ""; 873 EXIFInfo exifInfo_; 874 jpegDecoder->GetImagePropertyString(0, key, value); 875 ASSERT_EQ(value, exifInfo_.bitsPerSample_); 876 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest001 end"; 877 } 878 879 /** 880 * @tc.name: GetImagePropertyStringTest002 881 * @tc.desc: Test of GetImagePropertyString 882 * @tc.type: FUNC 883 */ 884 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest002, TestSize.Level3) 885 { 886 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest002 start"; 887 auto jpegDecoder = std::make_shared<JpegDecoder>(); 888 int size = STREAM_SIZE; 889 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 890 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 891 jpegDecoder->SetSource(*streamPtr.release()); 892 std::string key = "Orientation"; 893 std::string value = ""; 894 EXIFInfo exifInfo_; 895 jpegDecoder->GetImagePropertyString(0, key, value); 896 ASSERT_EQ(value, exifInfo_.orientation_); 897 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest002 end"; 898 } 899 900 /** 901 * @tc.name: GetImagePropertyStringTest003 902 * @tc.desc: Test of GetImagePropertyString 903 * @tc.type: FUNC 904 */ 905 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest003, TestSize.Level3) 906 { 907 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest003 start"; 908 auto jpegDecoder = std::make_shared<JpegDecoder>(); 909 int size = STREAM_SIZE; 910 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 911 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 912 jpegDecoder->SetSource(*streamPtr.release()); 913 std::string key = "ImageLength"; 914 std::string value = ""; 915 EXIFInfo exifInfo_; 916 jpegDecoder->GetImagePropertyString(0, key, value); 917 ASSERT_EQ(value, exifInfo_.imageLength_); 918 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest003 end"; 919 } 920 921 /** 922 * @tc.name: GetImagePropertyStringTest004 923 * @tc.desc: Test of GetImagePropertyString 924 * @tc.type: FUNC 925 */ 926 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest004, TestSize.Level3) 927 { 928 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest004 start"; 929 auto jpegDecoder = std::make_shared<JpegDecoder>(); 930 int size = STREAM_SIZE; 931 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 932 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 933 jpegDecoder->SetSource(*streamPtr.release()); 934 std::string key = "ImageWidth"; 935 std::string value = ""; 936 EXIFInfo exifInfo_; 937 jpegDecoder->GetImagePropertyString(0, key, value); 938 ASSERT_EQ(value, exifInfo_.imageWidth_); 939 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest004 end"; 940 } 941 942 /** 943 * @tc.name: GetImagePropertyStringTest005 944 * @tc.desc: Test of GetImagePropertyString 945 * @tc.type: FUNC 946 */ 947 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest005, TestSize.Level3) 948 { 949 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest005 start"; 950 auto jpegDecoder = std::make_shared<JpegDecoder>(); 951 int size = STREAM_SIZE; 952 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 953 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 954 jpegDecoder->SetSource(*streamPtr.release()); 955 std::string key = "GPSLatitude"; 956 std::string value = ""; 957 EXIFInfo exifInfo_; 958 jpegDecoder->GetImagePropertyString(0, key, value); 959 ASSERT_EQ(value, exifInfo_.gpsLatitude_); 960 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest005 end"; 961 } 962 963 /** 964 * @tc.name: GetImagePropertyStringTest006 965 * @tc.desc: Test of GetImagePropertyString 966 * @tc.type: FUNC 967 */ 968 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest006, TestSize.Level3) 969 { 970 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest006 start"; 971 auto jpegDecoder = std::make_shared<JpegDecoder>(); 972 int size = STREAM_SIZE; 973 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 974 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 975 jpegDecoder->SetSource(*streamPtr.release()); 976 std::string key = "GPSLongitude"; 977 std::string value = ""; 978 EXIFInfo exifInfo_; 979 jpegDecoder->GetImagePropertyString(0, key, value); 980 ASSERT_EQ(value, exifInfo_.gpsLongitude_); 981 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest006 end"; 982 } 983 984 /** 985 * @tc.name: GetImagePropertyStringTest007 986 * @tc.desc: Test of GetImagePropertyString 987 * @tc.type: FUNC 988 */ 989 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest007, TestSize.Level3) 990 { 991 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest007 start"; 992 auto jpegDecoder = std::make_shared<JpegDecoder>(); 993 int size = STREAM_SIZE; 994 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 995 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 996 jpegDecoder->SetSource(*streamPtr.release()); 997 std::string key = "GPSLatitudeRef"; 998 std::string value = ""; 999 EXIFInfo exifInfo_; 1000 jpegDecoder->GetImagePropertyString(0, key, value); 1001 ASSERT_EQ(value, exifInfo_.gpsLatitudeRef_); 1002 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest007 end"; 1003 } 1004 1005 1006 /** 1007 * @tc.name: GetImagePropertyStringTest008 1008 * @tc.desc: Test of GetImagePropertyString 1009 * @tc.type: FUNC 1010 */ 1011 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest008, TestSize.Level3) 1012 { 1013 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest008 start"; 1014 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1015 int size = STREAM_SIZE; 1016 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1017 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1018 jpegDecoder->SetSource(*streamPtr.release()); 1019 std::string key = "GPSLongitudeRef"; 1020 std::string value = ""; 1021 EXIFInfo exifInfo_; 1022 jpegDecoder->GetImagePropertyString(0, key, value); 1023 ASSERT_EQ(value, exifInfo_.gpsLongitudeRef_); 1024 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest008 end"; 1025 } 1026 1027 /** 1028 * @tc.name: GetImagePropertyStringTest009 1029 * @tc.desc: Test of GetImagePropertyString 1030 * @tc.type: FUNC 1031 */ 1032 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest009, TestSize.Level3) 1033 { 1034 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest009 start"; 1035 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1036 int size = STREAM_SIZE; 1037 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1038 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1039 jpegDecoder->SetSource(*streamPtr.release()); 1040 std::string key = "DateTimeOriginal"; 1041 std::string value = ""; 1042 EXIFInfo exifInfo_; 1043 jpegDecoder->GetImagePropertyString(0, key, value); 1044 ASSERT_EQ(value, exifInfo_.dateTimeOriginal_); 1045 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest009 end"; 1046 } 1047 1048 /** 1049 * @tc.name: GetImagePropertyStringTest010 1050 * @tc.desc: Test of GetImagePropertyString 1051 * @tc.type: FUNC 1052 */ 1053 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest010, TestSize.Level3) 1054 { 1055 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest010 start"; 1056 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1057 int size = STREAM_SIZE; 1058 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1059 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1060 jpegDecoder->SetSource(*streamPtr.release()); 1061 std::string key = "DateTimeOriginalForMedia"; 1062 std::string value = ""; 1063 EXIFInfo exifInfo_; 1064 int32_t result = jpegDecoder->GetImagePropertyString(0, key, value); 1065 ASSERT_EQ(result, Media::SUCCESS); 1066 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest010 end"; 1067 } 1068 1069 /** 1070 * @tc.name: GetImagePropertyStringTest011 1071 * @tc.desc: Test of GetImagePropertyString 1072 * @tc.type: FUNC 1073 */ 1074 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest011, TestSize.Level3) 1075 { 1076 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest011 start"; 1077 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1078 int size = STREAM_SIZE; 1079 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1080 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1081 jpegDecoder->SetSource(*streamPtr.release()); 1082 std::string key = "ExposureTime"; 1083 std::string value = ""; 1084 EXIFInfo exifInfo_; 1085 jpegDecoder->GetImagePropertyString(0, key, value); 1086 ASSERT_EQ(value, exifInfo_.exposureTime_); 1087 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest011 end"; 1088 } 1089 1090 /** 1091 * @tc.name: GetImagePropertyStringTest012 1092 * @tc.desc: Test of GetImagePropertyString 1093 * @tc.type: FUNC 1094 */ 1095 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest012, TestSize.Level3) 1096 { 1097 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest012 start"; 1098 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1099 int size = STREAM_SIZE; 1100 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1101 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1102 jpegDecoder->SetSource(*streamPtr.release()); 1103 std::string key = "FNumber"; 1104 std::string value = ""; 1105 EXIFInfo exifInfo_; 1106 jpegDecoder->GetImagePropertyString(0, key, value); 1107 ASSERT_EQ(value, exifInfo_.fNumber_); 1108 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest012 end"; 1109 } 1110 1111 /** 1112 * @tc.name: GetImagePropertyStringTest013 1113 * @tc.desc: Test of GetImagePropertyString 1114 * @tc.type: FUNC 1115 */ 1116 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest013, TestSize.Level3) 1117 { 1118 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest013 start"; 1119 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1120 int size = STREAM_SIZE; 1121 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1122 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1123 jpegDecoder->SetSource(*streamPtr.release()); 1124 std::string key = "ISOSpeedRatings"; 1125 std::string value = ""; 1126 EXIFInfo exifInfo_; 1127 jpegDecoder->GetImagePropertyString(0, key, value); 1128 ASSERT_EQ(value, exifInfo_.isoSpeedRatings_); 1129 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest013 end"; 1130 } 1131 1132 /** 1133 * @tc.name: GetImagePropertyStringTest014 1134 * @tc.desc: Test of GetImagePropertyString 1135 * @tc.type: FUNC 1136 */ 1137 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest014, TestSize.Level3) 1138 { 1139 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest014 start"; 1140 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1141 int size = STREAM_SIZE; 1142 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1143 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1144 jpegDecoder->SetSource(*streamPtr.release()); 1145 std::string key = SCENE_TYPE; 1146 std::string value = ""; 1147 EXIFInfo exifInfo_; 1148 jpegDecoder->GetImagePropertyString(0, key, value); 1149 ASSERT_EQ(value, exifInfo_.sceneType_); 1150 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest014 end"; 1151 } 1152 1153 /** 1154 * @tc.name: GetImagePropertyStringTest015 1155 * @tc.desc: Test of GetImagePropertyString 1156 * @tc.type: FUNC 1157 */ 1158 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest015, TestSize.Level3) 1159 { 1160 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest015 start"; 1161 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1162 int size = STREAM_SIZE; 1163 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1164 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1165 jpegDecoder->SetSource(*streamPtr.release()); 1166 std::string key = ""; 1167 std::string value = ""; 1168 int32_t result = jpegDecoder->GetImagePropertyString(0, key, value); 1169 ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT); 1170 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest015 end"; 1171 } 1172 1173 /** 1174 * @tc.name: ModifyImagePropertyTest001 1175 * @tc.desc: Test of ModifyImageProperty 1176 * @tc.type: FUNC 1177 */ 1178 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest001, TestSize.Level3) 1179 { 1180 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest001 start"; 1181 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1182 int size = STREAM_SIZE; 1183 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1184 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1185 jpegDecoder->SetSource(*streamPtr.release()); 1186 std::string key = ""; 1187 std::string path = ""; 1188 std::string value = ""; 1189 int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, path); 1190 ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT); 1191 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest001 end"; 1192 } 1193 1194 /** 1195 * @tc.name: ModifyImagePropertyTest002 1196 * @tc.desc: Test of ModifyImageProperty 1197 * @tc.type: FUNC 1198 */ 1199 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest002, TestSize.Level3) 1200 { 1201 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest002 start"; 1202 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1203 int size = STREAM_SIZE; 1204 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1205 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1206 jpegDecoder->SetSource(*streamPtr.release()); 1207 std::string key = ORIENTATION; 1208 std::string path = ""; 1209 std::string value = ""; 1210 int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, path); 1211 ASSERT_EQ(result, Media::ERR_MEDIA_IO_ABNORMAL); 1212 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest002 end"; 1213 } 1214 1215 /** 1216 * @tc.name: ModifyImagePropertyTest003 1217 * @tc.desc: Test of ModifyImageProperty 1218 * @tc.type: FUNC 1219 */ 1220 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest003, TestSize.Level3) 1221 { 1222 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest003 start"; 1223 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1224 int size = STREAM_SIZE; 1225 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1226 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1227 jpegDecoder->SetSource(*streamPtr.release()); 1228 std::string key = IMAGE_LENGTH; 1229 std::string path = ""; 1230 std::string value = ""; 1231 int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, path); 1232 ASSERT_EQ(result, ERR_MEDIA_IO_ABNORMAL); 1233 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest003 end"; 1234 } 1235 1236 /** 1237 * @tc.name: ModifyImagePropertyTest004 1238 * @tc.desc: Test of ModifyImageProperty 1239 * @tc.type: FUNC 1240 */ 1241 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest004, TestSize.Level3) 1242 { 1243 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest004 start"; 1244 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1245 int size = STREAM_SIZE; 1246 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1247 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1248 jpegDecoder->SetSource(*streamPtr.release()); 1249 std::string key = IMAGE_LENGTH; 1250 std::string path = ""; 1251 std::string value = ""; 1252 int fd = 0; 1253 int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, fd); 1254 ASSERT_EQ(result, Media::ERR_MEDIA_BUFFER_TOO_SMALL); 1255 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest004 end"; 1256 } 1257 1258 /** 1259 * @tc.name: ModifyImagePropertyTest005 1260 * @tc.desc: Test of ModifyImageProperty 1261 * @tc.type: FUNC 1262 */ 1263 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest005, TestSize.Level3) 1264 { 1265 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest005 start"; 1266 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1267 int size = STREAM_SIZE; 1268 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size); 1269 auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size); 1270 jpegDecoder->SetSource(*streamPtr.release()); 1271 std::string key = ""; 1272 std::string path = ""; 1273 std::string value = ""; 1274 int fd = 0; 1275 int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, fd); 1276 ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT); 1277 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest005 end"; 1278 } 1279 1280 /** 1281 * @tc.name: GetImageSizeTest003 1282 * @tc.desc: Test of GetImageSize 1283 * @tc.type: FUNC 1284 */ 1285 HWTEST_F(JpegDecoderTest, GetImageSizeTest003, TestSize.Level3) 1286 { 1287 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest003 start"; 1288 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1289 ImagePlugin::Size plSize; 1290 ErrCodeOffset(2, 0); 1291 jpegDecoder->GetImageSize(1, plSize); 1292 jpegDecoder->GetImageSize(0, plSize); 1293 GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest003 end"; 1294 } 1295 1296 /** 1297 * @tc.name: GetRowBytesTest001 1298 * @tc.desc: Test of GetRowBytes 1299 * @tc.type: FUNC 1300 */ 1301 HWTEST_F(JpegDecoderTest, GetRowBytesTest001, TestSize.Level3) 1302 { 1303 GTEST_LOG_(INFO) << "JpegDecoderTest: GetRowBytesTest001 start"; 1304 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1305 jpegDecoder->GetRowBytes(); 1306 GTEST_LOG_(INFO) << "JpegDecoderTest: GetRowBytesTest001 end"; 1307 } 1308 1309 /** 1310 * @tc.name: ResetTest001 1311 * @tc.desc: Test of Reset 1312 * @tc.type: FUNC 1313 */ 1314 HWTEST_F(JpegDecoderTest, ResetTest001, TestSize.Level3) 1315 { 1316 GTEST_LOG_(INFO) << "JpegDecoderTest: ResetTest001 start"; 1317 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1318 jpegDecoder->JpegDecoder::Reset(); 1319 GTEST_LOG_(INFO) << "JpegDecoderTest: ResetTest001 end"; 1320 } 1321 1322 /** 1323 * @tc.name: FinishOldDecompressTest001 1324 * @tc.desc: Test of FinishOldDecompress 1325 * @tc.type: FUNC 1326 */ 1327 HWTEST_F(JpegDecoderTest, FinishOldDecompressTest001, TestSize.Level3) 1328 { 1329 GTEST_LOG_(INFO) << "JpegDecoderTest: FinishOldDecompressTest001 start"; 1330 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1331 jpegDecoder->FinishOldDecompress(); 1332 GTEST_LOG_(INFO) << "JpegDecoderTest: FinishOldDecompressTest001 end"; 1333 } 1334 1335 /** 1336 * @tc.name: FormatTimeStampTest001 1337 * @tc.desc: Test of FormatTimeStamp 1338 * @tc.type: FUNC 1339 */ 1340 HWTEST_F(JpegDecoderTest, FormatTimeStampTest001, TestSize.Level3) 1341 { 1342 GTEST_LOG_(INFO) << "JpegDecoderTest: FormatTimeStampTest001 start"; 1343 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1344 std::string value = ""; 1345 std::string src = "2023-10-15 12:34:56"; 1346 jpegDecoder->FormatTimeStamp(value, src); 1347 GTEST_LOG_(INFO) << "JpegDecoderTest: FormatTimeStampTest001 end"; 1348 } 1349 1350 /** 1351 * @tc.name: getExifTagFromKeyTest001 1352 * @tc.desc: Test of getExifTagFromKey 1353 * @tc.type: FUNC 1354 */ 1355 HWTEST_F(JpegDecoderTest, getExifTagFromKeyTest001, TestSize.Level3) 1356 { 1357 GTEST_LOG_(INFO) << "JpegDecoderTest: getExifTagFromKeyTest001 start"; 1358 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1359 const std::string key1 ="BitsPerSample"; 1360 jpegDecoder->JpegDecoder::getExifTagFromKey(key1); 1361 const std::string key2 ="Orientation"; 1362 jpegDecoder->JpegDecoder::getExifTagFromKey(key2); 1363 const std::string key3 ="ImageLength"; 1364 jpegDecoder->JpegDecoder::getExifTagFromKey(key3); 1365 const std::string key4 ="ImageWidth"; 1366 jpegDecoder->JpegDecoder::getExifTagFromKey(key4); 1367 const std::string key5 ="GPSLatitude"; 1368 jpegDecoder->JpegDecoder::getExifTagFromKey(key5); 1369 const std::string key6 ="GPSLongitude"; 1370 jpegDecoder->JpegDecoder::getExifTagFromKey(key6); 1371 const std::string key7 ="GPSLatitudeRef"; 1372 jpegDecoder->JpegDecoder::getExifTagFromKey(key7); 1373 const std::string key8 ="GPSLongitudeRef"; 1374 jpegDecoder->JpegDecoder::getExifTagFromKey(key8); 1375 const std::string key9 ="DateTimeOriginal"; 1376 jpegDecoder->JpegDecoder::getExifTagFromKey(key9); 1377 const std::string key10 ="ExposureTime"; 1378 jpegDecoder->JpegDecoder::getExifTagFromKey(key10); 1379 const std::string key11 ="FNumber"; 1380 jpegDecoder->JpegDecoder::getExifTagFromKey(key11); 1381 const std::string key12 ="ISOSpeedRatings"; 1382 jpegDecoder->JpegDecoder::getExifTagFromKey(key12); 1383 const std::string key13 ="SceneType"; 1384 jpegDecoder->JpegDecoder::getExifTagFromKey(key13); 1385 const std::string key14 ="CompressedBitsPerPixel"; 1386 jpegDecoder->JpegDecoder::getExifTagFromKey(key14); 1387 const std::string key15 ="GPSTimeStamp"; 1388 jpegDecoder->JpegDecoder::getExifTagFromKey(key15); 1389 GTEST_LOG_(INFO) << "JpegDecoderTest: getExifTagFromKeyTest001 end"; 1390 } 1391 1392 /** 1393 * @tc.name: ModifyImagePropertyTest006 1394 * @tc.desc: Test of ModifyImageProperty 1395 * @tc.type: FUNC 1396 */ 1397 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest006, TestSize.Level3) 1398 { 1399 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest006 start"; 1400 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1401 uint32_t index = 1; 1402 const std::string key = "GPSTimeStamp"; 1403 const std::string value = "111"; 1404 const std::string path = " "; 1405 int32_t result = jpegDecoder->ModifyImageProperty(index, key, value, path); 1406 ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT); 1407 GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest006 end"; 1408 } 1409 1410 /** 1411 * @tc.name: GetFilterAreaTest001 1412 * @tc.desc: Test of GetFilterArea 1413 * @tc.type: FUNC 1414 */ 1415 HWTEST_F(JpegDecoderTest, GetFilterAreaTest001, TestSize.Level3) 1416 { 1417 GTEST_LOG_(INFO) << "JpegDecoderTest: GetFilterAreaTest001 start"; 1418 auto jpegDecoder = std::make_shared<JpegDecoder>(); 1419 std::vector<std::pair<uint32_t, uint32_t>> ranges; 1420 uint32_t ret = jpegDecoder->GetFilterArea(1, ranges); 1421 EXPECT_EQ(ret, Media::ERR_MEDIA_INVALID_OPERATION); 1422 GTEST_LOG_(INFO) << "JpegDecoderTest: GetFilterAreaTest001 end"; 1423 } 1424 } 1425 }