• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     int size = 1;
616     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
617     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
618     ASSERT_NE(streamPtr, nullptr);
619     jpegDecoder->SetSource(*streamPtr.release());
620     PixelDecodeOptions opts;
621     PlImageInfo info;
622     // goto : return ret
623     uint32_t result = jpegDecoder->SetDecodeOptions(0, opts, info);
624     ASSERT_EQ(result, ERR_IMAGE_SOURCE_DATA_INCOMPLETE);
625     GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest001 end";
626 }
627 
628 /**
629  * @tc.name: SetDecodeOptionsTest002
630  * @tc.desc: Test of SetDecodeOptions
631  * @tc.type: FUNC
632  */
633 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest002, TestSize.Level3)
634 {
635     GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest002 start";
636     auto jpegDecoder = std::make_shared<JpegDecoder>();
637     int size = STREAM_SIZE;
638     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
639     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
640     jpegDecoder->SetSource(*streamPtr.release());
641     PixelDecodeOptions opts;
642     PlImageInfo info;
643     uint32_t result = jpegDecoder->SetDecodeOptions(JPEG_IMAGE_NUM, opts, info);
644     ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER);
645     GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest002 end";
646 }
647 
648 /**
649  * @tc.name: SetDecodeOptionsTest003
650  * @tc.desc: Test of SetDecodeOptions
651  * @tc.type: FUNC
652  */
653 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest003, TestSize.Level3)
654 {
655     GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest003 start";
656     auto jpegDecoder = std::make_shared<JpegDecoder>();
657     auto mock = std::make_shared<MockInputDataStream>();
658     mock->SetReturn(false);
659     jpegDecoder->SetSource(*mock.get());
660     PixelDecodeOptions opts;
661     PlImageInfo info;
662     uint32_t result = jpegDecoder->SetDecodeOptions(1, opts, info);
663     ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER);
664     GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest003 end";
665 }
666 
667 /**
668  * @tc.name: SetDecodeOptionsTest004
669  * @tc.desc: Test of SetDecodeOptions
670  * @tc.type: FUNC
671  */
672 HWTEST_F(JpegDecoderTest, SetDecodeOptionsTest004, TestSize.Level3)
673 {
674     GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest004 start";
675     auto jpegDecoder = std::make_shared<JpegDecoder>();
676     PixelDecodeOptions opts;
677     PlImageInfo info;
678     uint32_t result = jpegDecoder->SetDecodeOptions(0, opts, info);
679     // goto DecoderHeader return ERR_IMAGE_SOURCE_DATA_INCOMPLETE
680     ASSERT_EQ(result, ERR_MEDIA_INVALID_OPERATION);
681     GTEST_LOG_(INFO) << "JpegDecoderTest: SetDecodeOptionsTest004 end";
682 }
683 
684 /**
685  * @tc.name: GetImageSizeTest001
686  * @tc.desc: Test of GetImageSize
687  * @tc.type: FUNC
688  */
689 HWTEST_F(JpegDecoderTest, GetImageSizeTest001, TestSize.Level3)
690 {
691     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest001 start";
692     auto jpegDecoder = std::make_shared<JpegDecoder>();
693     int size = 1;
694     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
695     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
696     ASSERT_NE(streamPtr, nullptr);
697     jpegDecoder->SetSource(*streamPtr.release());
698     ImagePlugin::Size plSize;
699     uint32_t result = jpegDecoder->GetImageSize(0, plSize);
700     // goto DecodeHeader return ERR_IMAGE_SOURCE_DATA_INCOMPLETE
701     ASSERT_EQ(result, ERR_IMAGE_SOURCE_DATA_INCOMPLETE);
702     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest001 end";
703 }
704 
705 /**
706  * @tc.name: GetImageSizeTest002
707  * @tc.desc: Test of GetImageSize
708  * @tc.type: FUNC
709  */
710 HWTEST_F(JpegDecoderTest, GetImageSizeTest002, TestSize.Level3)
711 {
712     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest002 start";
713     auto jpegDecoder = std::make_shared<JpegDecoder>();
714     int size = STREAM_SIZE;
715     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
716     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
717     ImagePlugin::Size plSize;
718     uint32_t result = jpegDecoder->GetImageSize(0, plSize);
719     // goto DecodeHeader return ERR_IMAGE_DECODE_ABNORMAL
720     ASSERT_EQ(result, ERR_MEDIA_INVALID_OPERATION);
721     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest002 end";
722 }
723 
724 /**
725  * @tc.name: GetImageSizeTest004
726  * @tc.desc: Test of GetImageSize
727  * @tc.type: FUNC
728  */
729 HWTEST_F(JpegDecoderTest, GetImageSizeTest004, TestSize.Level3)
730 {
731     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest004 start";
732     auto jpegDecoder = std::make_shared<JpegDecoder>();
733     int size = STREAM_SIZE;
734     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
735     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
736     ImagePlugin::Size plSize;
737     jpegDecoder->SetSource(*streamPtr.release());
738     // check input parameter, index = JPEG_IMAGE_NUM
739     uint32_t result = jpegDecoder->GetImageSize(JPEG_IMAGE_NUM, plSize);
740     ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER);
741     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest004 end";
742 }
743 
744 /**
745  * @tc.name: DecodeTest001
746  * @tc.desc: Test of Decode
747  * @tc.type: FUNC
748  */
749 HWTEST_F(JpegDecoderTest, DecodeTest001, TestSize.Level3)
750 {
751     GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest001 start";
752     auto jpegDecoder = std::make_shared<JpegDecoder>();
753     int size = STREAM_SIZE;
754     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
755     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
756     jpegDecoder->SetSource(*streamPtr.release());
757     DecodeContext context;
758     uint32_t result = jpegDecoder->Decode(0, context);
759     ASSERT_EQ(result, ERR_MEDIA_INVALID_OPERATION);
760     GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest001 end";
761 }
762 
763 /**
764  * @tc.name: DecodeTest002
765  * @tc.desc: Test of Decode
766  * @tc.type: FUNC
767  */
768 HWTEST_F(JpegDecoderTest, DecodeTest002, TestSize.Level3)
769 {
770     GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest002 start";
771     auto jpegDecoder = std::make_shared<JpegDecoder>();
772     int size = STREAM_SIZE;
773     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
774     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
775     jpegDecoder->SetSource(*streamPtr.release());
776     DecodeContext context;
777     uint32_t result = jpegDecoder->Decode(JPEG_IMAGE_NUM, context);
778     ASSERT_EQ(result, ERR_IMAGE_INVALID_PARAMETER);
779     GTEST_LOG_(INFO) << "JpegDecoderTest: DecodeTest002 end";
780 }
781 
782 /**
783  * @tc.name: GetImagePropertyIntTest001
784  * @tc.desc: Test of GetImagePropertyInt
785  * @tc.type: FUNC
786  */
787 HWTEST_F(JpegDecoderTest, GetImagePropertyIntTest001, TestSize.Level3)
788 {
789     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest001 start";
790     auto jpegDecoder = std::make_shared<JpegDecoder>();
791     int size = STREAM_SIZE;
792     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
793     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
794     jpegDecoder->SetSource(*streamPtr.release());
795     std::string key = "Orientation";
796     int32_t value = 0;
797     uint32_t result = jpegDecoder->GetImagePropertyInt(0, key, value);
798     ASSERT_EQ(result, Media::ERR_MEDIA_VALUE_INVALID);
799     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest001 end";
800 }
801 
802 /**
803  * @tc.name: GetImagePropertyIntTest002
804  * @tc.desc: Test of GetImagePropertyInt
805  * @tc.type: FUNC
806  */
807 HWTEST_F(JpegDecoderTest, GetImagePropertyIntTest002, TestSize.Level3)
808 {
809     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest002 start";
810     auto jpegDecoder = std::make_shared<JpegDecoder>();
811     int size = STREAM_SIZE;
812     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
813     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
814     jpegDecoder->SetSource(*streamPtr.release());
815     std::string key = "ImageLength";
816     int32_t value = 0;
817     uint32_t result = jpegDecoder->GetImagePropertyInt(0, key, value);
818     ASSERT_EQ(result, Media::ERR_MEDIA_VALUE_INVALID);
819     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest002 end";
820 }
821 
822 /**
823  * @tc.name: GetImagePropertyIntTest003
824  * @tc.desc: Test of GetImagePropertyInt
825  * @tc.type: FUNC
826  */
827 HWTEST_F(JpegDecoderTest, GetImagePropertyIntTest003, TestSize.Level3)
828 {
829     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest003 start";
830     auto jpegDecoder = std::make_shared<JpegDecoder>();
831     int size = STREAM_SIZE;
832     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
833     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
834     jpegDecoder->SetSource(*streamPtr.release());
835     std::string key = ACTUAL_IMAGE_ENCODED_FORMAT;
836     int32_t value = 0;
837     uint32_t result = jpegDecoder->GetImagePropertyInt(0, key, value);
838     ASSERT_EQ(result, Media::ERR_MEDIA_VALUE_INVALID);
839     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyIntTest003 end";
840 }
841 
842 /**
843  * @tc.name: GetImagePropertyStringTest001
844  * @tc.desc: Test of GetImagePropertyString
845  * @tc.type: FUNC
846  */
847 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest001, TestSize.Level3)
848 {
849     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest001 start";
850     auto jpegDecoder = std::make_shared<JpegDecoder>();
851     int size = STREAM_SIZE;
852     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
853     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
854     jpegDecoder->SetSource(*streamPtr.release());
855     std::string key = "BitsPerSample";
856     std::string value = "";
857     EXIFInfo exifInfo_;
858     jpegDecoder->GetImagePropertyString(0, key, value);
859     ASSERT_EQ(value, exifInfo_.bitsPerSample_);
860     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest001 end";
861 }
862 
863 /**
864  * @tc.name: GetImagePropertyStringTest002
865  * @tc.desc: Test of GetImagePropertyString
866  * @tc.type: FUNC
867  */
868 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest002, TestSize.Level3)
869 {
870     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest002 start";
871     auto jpegDecoder = std::make_shared<JpegDecoder>();
872     int size = STREAM_SIZE;
873     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
874     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
875     jpegDecoder->SetSource(*streamPtr.release());
876     std::string key = "Orientation";
877     std::string value = "";
878     EXIFInfo exifInfo_;
879     jpegDecoder->GetImagePropertyString(0, key, value);
880     ASSERT_EQ(value, exifInfo_.orientation_);
881     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest002 end";
882 }
883 
884 /**
885  * @tc.name: GetImagePropertyStringTest003
886  * @tc.desc: Test of GetImagePropertyString
887  * @tc.type: FUNC
888  */
889 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest003, TestSize.Level3)
890 {
891     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest003 start";
892     auto jpegDecoder = std::make_shared<JpegDecoder>();
893     int size = STREAM_SIZE;
894     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
895     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
896     jpegDecoder->SetSource(*streamPtr.release());
897     std::string key = "ImageLength";
898     std::string value = "";
899     EXIFInfo exifInfo_;
900     jpegDecoder->GetImagePropertyString(0, key, value);
901     ASSERT_EQ(value, exifInfo_.imageLength_);
902     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest003 end";
903 }
904 
905 /**
906  * @tc.name: GetImagePropertyStringTest004
907  * @tc.desc: Test of GetImagePropertyString
908  * @tc.type: FUNC
909  */
910 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest004, TestSize.Level3)
911 {
912     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest004 start";
913     auto jpegDecoder = std::make_shared<JpegDecoder>();
914     int size = STREAM_SIZE;
915     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
916     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
917     jpegDecoder->SetSource(*streamPtr.release());
918     std::string key = "ImageWidth";
919     std::string value = "";
920     EXIFInfo exifInfo_;
921     jpegDecoder->GetImagePropertyString(0, key, value);
922     ASSERT_EQ(value, exifInfo_.imageWidth_);
923     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest004 end";
924 }
925 
926 /**
927  * @tc.name: GetImagePropertyStringTest005
928  * @tc.desc: Test of GetImagePropertyString
929  * @tc.type: FUNC
930  */
931 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest005, TestSize.Level3)
932 {
933     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest005 start";
934     auto jpegDecoder = std::make_shared<JpegDecoder>();
935     int size = STREAM_SIZE;
936     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
937     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
938     jpegDecoder->SetSource(*streamPtr.release());
939     std::string key = "GPSLatitude";
940     std::string value = "";
941     EXIFInfo exifInfo_;
942     jpegDecoder->GetImagePropertyString(0, key, value);
943     ASSERT_EQ(value, exifInfo_.gpsLatitude_);
944     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest005 end";
945 }
946 
947 /**
948  * @tc.name: GetImagePropertyStringTest006
949  * @tc.desc: Test of GetImagePropertyString
950  * @tc.type: FUNC
951  */
952 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest006, TestSize.Level3)
953 {
954     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest006 start";
955     auto jpegDecoder = std::make_shared<JpegDecoder>();
956     int size = STREAM_SIZE;
957     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
958     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
959     jpegDecoder->SetSource(*streamPtr.release());
960     std::string key = "GPSLongitude";
961     std::string value = "";
962     EXIFInfo exifInfo_;
963     jpegDecoder->GetImagePropertyString(0, key, value);
964     ASSERT_EQ(value, exifInfo_.gpsLongitude_);
965     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest006 end";
966 }
967 
968 /**
969  * @tc.name: GetImagePropertyStringTest007
970  * @tc.desc: Test of GetImagePropertyString
971  * @tc.type: FUNC
972  */
973 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest007, TestSize.Level3)
974 {
975     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest007 start";
976     auto jpegDecoder = std::make_shared<JpegDecoder>();
977     int size = STREAM_SIZE;
978     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
979     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
980     jpegDecoder->SetSource(*streamPtr.release());
981     std::string key = "GPSLatitudeRef";
982     std::string value = "";
983     EXIFInfo exifInfo_;
984     jpegDecoder->GetImagePropertyString(0, key, value);
985     ASSERT_EQ(value, exifInfo_.gpsLatitudeRef_);
986     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest007 end";
987 }
988 
989 
990 /**
991  * @tc.name: GetImagePropertyStringTest008
992  * @tc.desc: Test of GetImagePropertyString
993  * @tc.type: FUNC
994  */
995 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest008, TestSize.Level3)
996 {
997     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest008 start";
998     auto jpegDecoder = std::make_shared<JpegDecoder>();
999     int size = STREAM_SIZE;
1000     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1001     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1002     jpegDecoder->SetSource(*streamPtr.release());
1003     std::string key = "GPSLongitudeRef";
1004     std::string value = "";
1005     EXIFInfo exifInfo_;
1006     jpegDecoder->GetImagePropertyString(0, key, value);
1007     ASSERT_EQ(value, exifInfo_.gpsLongitudeRef_);
1008     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest008 end";
1009 }
1010 
1011 /**
1012  * @tc.name: GetImagePropertyStringTest009
1013  * @tc.desc: Test of GetImagePropertyString
1014  * @tc.type: FUNC
1015  */
1016 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest009, TestSize.Level3)
1017 {
1018     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest009 start";
1019     auto jpegDecoder = std::make_shared<JpegDecoder>();
1020     int size = STREAM_SIZE;
1021     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1022     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1023     jpegDecoder->SetSource(*streamPtr.release());
1024     std::string key = "DateTimeOriginal";
1025     std::string value = "";
1026     EXIFInfo exifInfo_;
1027     jpegDecoder->GetImagePropertyString(0, key, value);
1028     ASSERT_EQ(value, exifInfo_.dateTimeOriginal_);
1029     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest009 end";
1030 }
1031 
1032 /**
1033  * @tc.name: GetImagePropertyStringTest010
1034  * @tc.desc: Test of GetImagePropertyString
1035  * @tc.type: FUNC
1036  */
1037 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest010, TestSize.Level3)
1038 {
1039     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest010 start";
1040     auto jpegDecoder = std::make_shared<JpegDecoder>();
1041     int size = STREAM_SIZE;
1042     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1043     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1044     jpegDecoder->SetSource(*streamPtr.release());
1045     std::string key = "DateTimeOriginalForMedia";
1046     std::string value = "";
1047     EXIFInfo exifInfo_;
1048     int32_t result = jpegDecoder->GetImagePropertyString(0, key, value);
1049     ASSERT_EQ(result, Media::SUCCESS);
1050     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest010 end";
1051 }
1052 
1053 /**
1054  * @tc.name: GetImagePropertyStringTest011
1055  * @tc.desc: Test of GetImagePropertyString
1056  * @tc.type: FUNC
1057  */
1058 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest011, TestSize.Level3)
1059 {
1060     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest011 start";
1061     auto jpegDecoder = std::make_shared<JpegDecoder>();
1062     int size = STREAM_SIZE;
1063     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1064     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1065     jpegDecoder->SetSource(*streamPtr.release());
1066     std::string key = "ExposureTime";
1067     std::string value = "";
1068     EXIFInfo exifInfo_;
1069     jpegDecoder->GetImagePropertyString(0, key, value);
1070     ASSERT_EQ(value, exifInfo_.exposureTime_);
1071     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest011 end";
1072 }
1073 
1074 /**
1075  * @tc.name: GetImagePropertyStringTest012
1076  * @tc.desc: Test of GetImagePropertyString
1077  * @tc.type: FUNC
1078  */
1079 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest012, TestSize.Level3)
1080 {
1081     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest012 start";
1082     auto jpegDecoder = std::make_shared<JpegDecoder>();
1083     int size = STREAM_SIZE;
1084     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1085     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1086     jpegDecoder->SetSource(*streamPtr.release());
1087     std::string key = "FNumber";
1088     std::string value = "";
1089     EXIFInfo exifInfo_;
1090     jpegDecoder->GetImagePropertyString(0, key, value);
1091     ASSERT_EQ(value, exifInfo_.fNumber_);
1092     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest012 end";
1093 }
1094 
1095 /**
1096  * @tc.name: GetImagePropertyStringTest013
1097  * @tc.desc: Test of GetImagePropertyString
1098  * @tc.type: FUNC
1099  */
1100 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest013, TestSize.Level3)
1101 {
1102     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest013 start";
1103     auto jpegDecoder = std::make_shared<JpegDecoder>();
1104     int size = STREAM_SIZE;
1105     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1106     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1107     jpegDecoder->SetSource(*streamPtr.release());
1108     std::string key = "ISOSpeedRatings";
1109     std::string value = "";
1110     EXIFInfo exifInfo_;
1111     jpegDecoder->GetImagePropertyString(0, key, value);
1112     ASSERT_EQ(value, exifInfo_.isoSpeedRatings_);
1113     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest013 end";
1114 }
1115 
1116 /**
1117  * @tc.name: GetImagePropertyStringTest014
1118  * @tc.desc: Test of GetImagePropertyString
1119  * @tc.type: FUNC
1120  */
1121 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest014, TestSize.Level3)
1122 {
1123     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest014 start";
1124     auto jpegDecoder = std::make_shared<JpegDecoder>();
1125     int size = STREAM_SIZE;
1126     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1127     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1128     jpegDecoder->SetSource(*streamPtr.release());
1129     std::string key = SCENE_TYPE;
1130     std::string value = "";
1131     EXIFInfo exifInfo_;
1132     jpegDecoder->GetImagePropertyString(0, key, value);
1133     ASSERT_EQ(value, exifInfo_.sceneType_);
1134     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest014 end";
1135 }
1136 
1137 /**
1138  * @tc.name: GetImagePropertyStringTest015
1139  * @tc.desc: Test of GetImagePropertyString
1140  * @tc.type: FUNC
1141  */
1142 HWTEST_F(JpegDecoderTest, GetImagePropertyStringTest015, TestSize.Level3)
1143 {
1144     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest015 start";
1145     auto jpegDecoder = std::make_shared<JpegDecoder>();
1146     int size = STREAM_SIZE;
1147     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1148     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1149     jpegDecoder->SetSource(*streamPtr.release());
1150     std::string key = "";
1151     std::string value = "";
1152     int32_t result = jpegDecoder->GetImagePropertyString(0, key, value);
1153     ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT);
1154     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImagePropertyStringTest015 end";
1155 }
1156 
1157 /**
1158  * @tc.name: ModifyImagePropertyTest001
1159  * @tc.desc: Test of ModifyImageProperty
1160  * @tc.type: FUNC
1161  */
1162 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest001, TestSize.Level3)
1163 {
1164     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest001 start";
1165     auto jpegDecoder = std::make_shared<JpegDecoder>();
1166     int size = STREAM_SIZE;
1167     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1168     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1169     jpegDecoder->SetSource(*streamPtr.release());
1170     std::string key = "";
1171     std::string path = "";
1172     std::string value = "";
1173     int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, path);
1174     ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT);
1175     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest001 end";
1176 }
1177 
1178 /**
1179  * @tc.name: ModifyImagePropertyTest002
1180  * @tc.desc: Test of ModifyImageProperty
1181  * @tc.type: FUNC
1182  */
1183 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest002, TestSize.Level3)
1184 {
1185     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest002 start";
1186     auto jpegDecoder = std::make_shared<JpegDecoder>();
1187     int size = STREAM_SIZE;
1188     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1189     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1190     jpegDecoder->SetSource(*streamPtr.release());
1191     std::string key = ORIENTATION;
1192     std::string path = "";
1193     std::string value = "";
1194     int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, path);
1195     ASSERT_EQ(result, Media::ERR_MEDIA_IO_ABNORMAL);
1196     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest002 end";
1197 }
1198 
1199 /**
1200  * @tc.name: ModifyImagePropertyTest003
1201  * @tc.desc: Test of ModifyImageProperty
1202  * @tc.type: FUNC
1203  */
1204 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest003, TestSize.Level3)
1205 {
1206     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest003 start";
1207     auto jpegDecoder = std::make_shared<JpegDecoder>();
1208     int size = STREAM_SIZE;
1209     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1210     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1211     jpegDecoder->SetSource(*streamPtr.release());
1212     std::string key = IMAGE_LENGTH;
1213     std::string path = "";
1214     std::string value = "";
1215     int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, path);
1216     ASSERT_EQ(result, ERR_MEDIA_IO_ABNORMAL);
1217     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest003 end";
1218 }
1219 
1220 /**
1221  * @tc.name: ModifyImagePropertyTest004
1222  * @tc.desc: Test of ModifyImageProperty
1223  * @tc.type: FUNC
1224  */
1225 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest004, TestSize.Level3)
1226 {
1227     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest004 start";
1228     auto jpegDecoder = std::make_shared<JpegDecoder>();
1229     int size = STREAM_SIZE;
1230     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1231     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1232     jpegDecoder->SetSource(*streamPtr.release());
1233     std::string key = IMAGE_LENGTH;
1234     std::string path = "";
1235     std::string value = "";
1236     int fd = 0;
1237     int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, fd);
1238     ASSERT_EQ(result, Media::ERR_MEDIA_BUFFER_TOO_SMALL);
1239     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest004 end";
1240 }
1241 
1242 /**
1243  * @tc.name: ModifyImagePropertyTest005
1244  * @tc.desc: Test of ModifyImageProperty
1245  * @tc.type: FUNC
1246  */
1247 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest005, TestSize.Level3)
1248 {
1249     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest005 start";
1250     auto jpegDecoder = std::make_shared<JpegDecoder>();
1251     int size = STREAM_SIZE;
1252     std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(size);
1253     auto streamPtr = BufferSourceStream::CreateSourceStream(data.get(), size);
1254     jpegDecoder->SetSource(*streamPtr.release());
1255     std::string key = "";
1256     std::string path = "";
1257     std::string value = "";
1258     int fd = 0;
1259     int32_t result = jpegDecoder->ModifyImageProperty(0, key, value, fd);
1260     ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT);
1261     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest005 end";
1262 }
1263 
1264 /**
1265  * @tc.name: GetImageSizeTest003
1266  * @tc.desc: Test of GetImageSize
1267  * @tc.type: FUNC
1268  */
1269 HWTEST_F(JpegDecoderTest, GetImageSizeTest003, TestSize.Level3)
1270 {
1271     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest003 start";
1272     auto jpegDecoder = std::make_shared<JpegDecoder>();
1273     ImagePlugin::Size plSize;
1274     ErrCodeOffset(2, 0);
1275     jpegDecoder->GetImageSize(1, plSize);
1276     uint32_t ret = jpegDecoder->GetImageSize(0, plSize);
1277     ASSERT_EQ(ret, ERR_MEDIA_INVALID_OPERATION);
1278     GTEST_LOG_(INFO) << "JpegDecoderTest: GetImageSizeTest003 end";
1279 }
1280 
1281 /**
1282  * @tc.name: GetRowBytesTest001
1283  * @tc.desc: Test of GetRowBytes
1284  * @tc.type: FUNC
1285  */
1286 HWTEST_F(JpegDecoderTest, GetRowBytesTest001, TestSize.Level3)
1287 {
1288     GTEST_LOG_(INFO) << "JpegDecoderTest: GetRowBytesTest001 start";
1289     auto jpegDecoder = std::make_shared<JpegDecoder>();
1290     uint32_t ret = jpegDecoder->GetRowBytes();
1291     ASSERT_EQ(ret, 0);
1292     GTEST_LOG_(INFO) << "JpegDecoderTest: GetRowBytesTest001 end";
1293 }
1294 
1295 /**
1296  * @tc.name: ResetTest001
1297  * @tc.desc: Test of Reset
1298  * @tc.type: FUNC
1299  */
1300 HWTEST_F(JpegDecoderTest, ResetTest001, TestSize.Level3)
1301 {
1302     GTEST_LOG_(INFO) << "JpegDecoderTest: ResetTest001 start";
1303     auto jpegDecoder = std::make_shared<JpegDecoder>();
1304     jpegDecoder->JpegDecoder::Reset();
1305     ASSERT_EQ(jpegDecoder->srcMgr_.inputStream, nullptr);
1306     GTEST_LOG_(INFO) << "JpegDecoderTest: ResetTest001 end";
1307 }
1308 
1309 /**
1310  * @tc.name: FinishOldDecompressTest001
1311  * @tc.desc: Test of FinishOldDecompress
1312  * @tc.type: FUNC
1313  */
1314 HWTEST_F(JpegDecoderTest, FinishOldDecompressTest001, TestSize.Level3)
1315 {
1316     GTEST_LOG_(INFO) << "JpegDecoderTest: FinishOldDecompressTest001 start";
1317     jpeg_decompress_struct jpegCompressInfo;
1318     auto jpegDecoder = std::make_shared<JpegDecoder>();
1319     jpegDecoder->decodeInfo_ = jpegCompressInfo;
1320     jpegDecoder->FinishOldDecompress();
1321     ASSERT_NE(&(jpegDecoder->decodeInfo_), nullptr);
1322     GTEST_LOG_(INFO) << "JpegDecoderTest: FinishOldDecompressTest001 end";
1323 }
1324 
1325 /**
1326  * @tc.name: FormatTimeStampTest001
1327  * @tc.desc: Test of FormatTimeStamp
1328  * @tc.type: FUNC
1329  */
1330 HWTEST_F(JpegDecoderTest, FormatTimeStampTest001, TestSize.Level3)
1331 {
1332     GTEST_LOG_(INFO) << "JpegDecoderTest: FormatTimeStampTest001 start";
1333     auto jpegDecoder = std::make_shared<JpegDecoder>();
1334     std::string value = "";
1335     std::string src = "2023-10-15 12:34:56";
1336     jpegDecoder->FormatTimeStamp(value, src);
1337     ASSERT_EQ(value, "2023-10-15 12:34:56");
1338     GTEST_LOG_(INFO) << "JpegDecoderTest: FormatTimeStampTest001 end";
1339 }
1340 
1341 /**
1342  * @tc.name: getExifTagFromKeyTest001
1343  * @tc.desc: Test of getExifTagFromKey
1344  * @tc.type: FUNC
1345  */
1346 HWTEST_F(JpegDecoderTest, getExifTagFromKeyTest001, TestSize.Level3)
1347 {
1348     GTEST_LOG_(INFO) << "JpegDecoderTest: getExifTagFromKeyTest001 start";
1349     auto jpegDecoder = std::make_shared<JpegDecoder>();
1350     const std::string key1 ="BitsPerSample";
1351     ExifTag ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key1);
1352     ASSERT_EQ(ret, EXIF_TAG_BITS_PER_SAMPLE);
1353     const std::string key2 ="Orientation";
1354     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key2);
1355     ASSERT_EQ(ret, EXIF_TAG_ORIENTATION);
1356     const std::string key3 ="ImageLength";
1357     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key3);
1358     ASSERT_EQ(ret, EXIF_TAG_IMAGE_LENGTH);
1359     const std::string key4 ="ImageWidth";
1360     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key4);
1361     ASSERT_EQ(ret, EXIF_TAG_IMAGE_WIDTH);
1362     const std::string key5 ="GPSLatitude";
1363     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key5);
1364     ASSERT_EQ(ret, EXIF_TAG_GPS_LATITUDE);
1365     const std::string key6 ="GPSLongitude";
1366     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key6);
1367     ASSERT_EQ(ret, EXIF_TAG_GPS_LONGITUDE);
1368     const std::string key7 ="GPSLatitudeRef";
1369     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key7);
1370     ASSERT_EQ(ret, EXIF_TAG_GPS_LATITUDE_REF);
1371     const std::string key8 ="GPSLongitudeRef";
1372     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key8);
1373     ASSERT_EQ(ret, EXIF_TAG_GPS_LONGITUDE_REF);
1374     const std::string key9 ="DateTimeOriginal";
1375     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key9);
1376     ASSERT_EQ(ret, EXIF_TAG_DATE_TIME_ORIGINAL);
1377     const std::string key10 ="ExposureTime";
1378     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key10);
1379     ASSERT_EQ(ret, EXIF_TAG_EXPOSURE_TIME);
1380     const std::string key11 ="FNumber";
1381     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key11);
1382     ASSERT_EQ(ret, EXIF_TAG_FNUMBER);
1383     const std::string key12 ="ISOSpeedRatings";
1384     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key12);
1385     ASSERT_EQ(ret, EXIF_TAG_ISO_SPEED_RATINGS);
1386     const std::string key13 ="SceneType";
1387     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key13);
1388     ASSERT_EQ(ret, EXIF_TAG_SCENE_TYPE);
1389     const std::string key14 ="CompressedBitsPerPixel";
1390     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key14);
1391     ASSERT_EQ(ret, EXIF_TAG_COMPRESSED_BITS_PER_PIXEL);
1392     const std::string key15 ="GPSTimeStamp";
1393     ret = jpegDecoder->JpegDecoder::getExifTagFromKey(key15);
1394     ASSERT_EQ(ret, EXIF_TAG_PRINT_IMAGE_MATCHING);
1395     GTEST_LOG_(INFO) << "JpegDecoderTest: getExifTagFromKeyTest001 end";
1396 }
1397 
1398 /**
1399  * @tc.name: ModifyImagePropertyTest006
1400  * @tc.desc: Test of ModifyImageProperty
1401  * @tc.type: FUNC
1402  */
1403 HWTEST_F(JpegDecoderTest, ModifyImagePropertyTest006, TestSize.Level3)
1404 {
1405     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest006 start";
1406     auto jpegDecoder = std::make_shared<JpegDecoder>();
1407     uint32_t index = 1;
1408     const std::string key = "GPSTimeStamp";
1409     const std::string value = "111";
1410     const std::string path = " ";
1411     int32_t result = jpegDecoder->ModifyImageProperty(index, key, value, path);
1412     ASSERT_EQ(result, Media::ERR_IMAGE_DECODE_EXIF_UNSUPPORT);
1413     GTEST_LOG_(INFO) << "JpegDecoderTest: ModifyImagePropertyTest006 end";
1414 }
1415 
1416 /**
1417  * @tc.name: GetFilterAreaTest001
1418  * @tc.desc: Test of GetFilterArea
1419  * @tc.type: FUNC
1420  */
1421 HWTEST_F(JpegDecoderTest, GetFilterAreaTest001, TestSize.Level3)
1422 {
1423     GTEST_LOG_(INFO) << "JpegDecoderTest: GetFilterAreaTest001 start";
1424     auto jpegDecoder = std::make_shared<JpegDecoder>();
1425     std::vector<std::pair<uint32_t, uint32_t>> ranges;
1426     uint32_t ret = jpegDecoder->GetFilterArea(1, ranges);
1427     EXPECT_EQ(ret, Media::ERR_MEDIA_INVALID_OPERATION);
1428     GTEST_LOG_(INFO) << "JpegDecoderTest: GetFilterAreaTest001 end";
1429 }
1430 }
1431 }