1 /*
2  * Copyright (C) 2024 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 #include <gtest/gtest.h>
17 #include <memory>
18 #include "libexif/exif-tag.h"
19 #include "media_errors.h"
20 #include "tiff_parser.h"
21 #include "exif_metadata.h"
22 #include "exif_metadata_formatter.h"
23 #include "image_log.h"
24 
25 using namespace OHOS::Media;
26 using namespace testing::ext;
27 
28 namespace OHOS {
29 namespace Multimedia {
30 static const std::string IMAGE_INPUT_JPEG_PATH = "/data/local/tmp/image/test_metadata.jpg";
31 static const std::string IMAGE_INPUT_JPEG_BLANKEXIF_PATH = "/data/local/tmp/image/test_exif_blank.jpg";
32 static const std::string IMAGE_INPUT_JPEG_HW_PATH = "/data/local/tmp/image/test_hwkey.jpg";
33 static const std::string IMAGE_INPUT_JPEG_RM_ENTRY_PATH = "/data/local/tmp/image/test_entrys.jpg";
34 
35 class ExifMetadataTest : public testing::Test {
36 public:
ExifMetadataTest()37     ExifMetadataTest() {}
~ExifMetadataTest()38     ~ExifMetadataTest() {}
39 };
40 
41 HWTEST_F(ExifMetadataTest, SetValue001, TestSize.Level3)
42 {
43     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
44     ASSERT_NE(exifData, nullptr);
45     ExifMetadata metadata(exifData);
46     ASSERT_TRUE(metadata.SetValue("BitsPerSample", "9,9,8"));
47     ASSERT_TRUE(metadata.SetValue("Orientation", "1"));
48     ASSERT_TRUE(metadata.SetValue("ImageLength", "1000"));
49     ASSERT_TRUE(metadata.SetValue("ImageWidth", "1001"));
50     ASSERT_TRUE(metadata.SetValue("GPSLatitude", "39,54,20"));
51     ASSERT_TRUE(metadata.SetValue("GPSLongitude", "120,52,26"));
52     ASSERT_TRUE(metadata.SetValue("GPSLatitudeRef", "N"));
53     ASSERT_TRUE(metadata.SetValue("GPSLongitudeRef", "E"));
54     ASSERT_TRUE(metadata.SetValue("DateTimeOriginal", "2024:01:25 05:51:34"));
55     ASSERT_TRUE(metadata.SetValue("ExposureTime", "1/34"));
56     ASSERT_TRUE(metadata.SetValue("SceneType", "1"));
57     ASSERT_TRUE(metadata.SetValue("ISOSpeedRatings", "160"));
58     ASSERT_TRUE(metadata.SetValue("FNumber", "3/1"));
59     ASSERT_TRUE(metadata.SetValue("DateTime", "2024:01:25 05:51:34"));
60     ASSERT_TRUE(metadata.SetValue("GPSTimeStamp", "11:37:56"));
61     ASSERT_TRUE(metadata.SetValue("ImageDescription", "_cuva"));
62     ASSERT_TRUE(metadata.SetValue("Model", "TNY-AL00"));
63     ASSERT_TRUE(metadata.SetValue("SensitivityType", "5"));
64     ASSERT_TRUE(metadata.SetValue("StandardOutputSensitivity", "5"));
65     ASSERT_TRUE(metadata.SetValue("RecommendedExposureIndex", "241"));
66     ASSERT_TRUE(metadata.SetValue("ISOSpeedRatings", "160"));
67     ASSERT_TRUE(metadata.SetValue("ApertureValue", "4/1"));
68     ASSERT_TRUE(metadata.SetValue("ExposureBiasValue", "23/1"));
69     ASSERT_TRUE(metadata.SetValue("MeteringMode", "5"));
70     ASSERT_TRUE(metadata.SetValue("LightSource", "2"));
71     ASSERT_TRUE(metadata.SetValue("Flash", "5"));
72     ASSERT_TRUE(metadata.SetValue("FocalLength", "31/1"));
73     ASSERT_TRUE(metadata.SetValue("UserComment", "comm"));
74     ASSERT_TRUE(metadata.SetValue("PixelXDimension", "1000"));
75     ASSERT_TRUE(metadata.SetValue("PixelYDimension", "2000"));
76     ASSERT_TRUE(metadata.SetValue("WhiteBalance", "1"));
77     ASSERT_TRUE(metadata.SetValue("FocalLengthIn35mmFilm", "2"));
78 }
79 
80 HWTEST_F(ExifMetadataTest, GetValue001, TestSize.Level3)
81 {
82     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
83     ASSERT_NE(exifData, nullptr);
84     std::string value;
85     ExifMetadata metadata(exifData);
86     ASSERT_TRUE(metadata.SetValue("BitsPerSample", "9,9,8"));
87     metadata.GetValue("BitsPerSample", value);
88     ASSERT_EQ(value, "9, 9, 8");
89 }
90 
91 HWTEST_F(ExifMetadataTest, GetValue002, TestSize.Level3)
92 {
93     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
94     ASSERT_NE(exifData, nullptr);
95     std::string value;
96     ExifMetadata metadata(exifData);
97     ASSERT_TRUE(metadata.SetValue("Orientation", "1"));
98     metadata.GetValue("Orientation", value);
99     ASSERT_EQ(value, "Top-left");
100 }
101 
102 HWTEST_F(ExifMetadataTest, GetValue003, TestSize.Level3)
103 {
104     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
105     ASSERT_NE(exifData, nullptr);
106     std::string value;
107     ExifMetadata metadata(exifData);
108     ASSERT_TRUE(metadata.SetValue("ImageLength", "1000"));
109     metadata.GetValue("ImageLength", value);
110     ASSERT_EQ(value, "1000");
111 }
112 
113 HWTEST_F(ExifMetadataTest, GetValue004, TestSize.Level3)
114 {
115     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
116     ASSERT_NE(exifData, nullptr);
117     std::string value;
118     ExifMetadata metadata(exifData);
119     ASSERT_TRUE(metadata.SetValue("ImageWidth", "1001"));
120     metadata.GetValue("ImageWidth", value);
121     ASSERT_EQ(value, "1001");
122 }
123 
124 HWTEST_F(ExifMetadataTest, GetValue005, TestSize.Level3)
125 {
126     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
127     ASSERT_NE(exifData, nullptr);
128     std::string value;
129     ExifMetadata metadata(exifData);
130     ASSERT_TRUE(metadata.SetValue("GPSLatitude", "39,54,20"));
131     metadata.GetValue("GPSLatitude", value);
132     ASSERT_EQ(value, "39, 54, 20");
133 }
134 
135 HWTEST_F(ExifMetadataTest, GetValue006, TestSize.Level3)
136 {
137     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
138     ASSERT_NE(exifData, nullptr);
139     std::string value;
140     ExifMetadata metadata(exifData);
141     ASSERT_TRUE(metadata.SetValue("GPSLongitude", "120,52,26"));
142     metadata.GetValue("GPSLongitude", value);
143     ASSERT_EQ(value, "120, 52, 26");
144 }
145 
146 HWTEST_F(ExifMetadataTest, GetValue007, TestSize.Level3)
147 {
148     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
149     ASSERT_NE(exifData, nullptr);
150     std::string value;
151     ExifMetadata metadata(exifData);
152     ASSERT_TRUE(metadata.SetValue("GPSLatitudeRef", "N"));
153     metadata.GetValue("GPSLatitudeRef", value);
154     ASSERT_EQ(value, "N");
155 }
156 
157 HWTEST_F(ExifMetadataTest, GetValue008, TestSize.Level3)
158 {
159     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
160     ASSERT_NE(exifData, nullptr);
161     std::string value;
162     ExifMetadata metadata(exifData);
163     ASSERT_TRUE(metadata.SetValue("GPSLongitudeRef", "E"));
164     metadata.GetValue("GPSLongitudeRef", value);
165     ASSERT_EQ(value, "E");
166 }
167 
168 HWTEST_F(ExifMetadataTest, GetValue009, TestSize.Level3)
169 {
170     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
171     ASSERT_NE(exifData, nullptr);
172     std::string value;
173     ExifMetadata metadata(exifData);
174     ASSERT_TRUE(metadata.SetValue("DateTimeOriginal", "2024:01:25 05:51:34"));
175     metadata.GetValue("DateTimeOriginal", value);
176     ASSERT_EQ(value, "2024:01:25 05:51:34");
177 }
178 
179 HWTEST_F(ExifMetadataTest, GetValue010, TestSize.Level3)
180 {
181     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
182     ASSERT_NE(exifData, nullptr);
183     std::string value;
184     ExifMetadata metadata(exifData);
185     ASSERT_TRUE(metadata.SetValue("ExposureTime", "1/34"));
186     metadata.GetValue("ExposureTime", value);
187     ASSERT_EQ(value, "1/34 sec.");
188 }
189 
190 HWTEST_F(ExifMetadataTest, GetValue011, TestSize.Level3)
191 {
192     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
193     ASSERT_NE(exifData, nullptr);
194     std::string value;
195     ExifMetadata metadata(exifData);
196     ASSERT_TRUE(metadata.SetValue("SceneType", "1"));
197     metadata.GetValue("SceneType", value);
198     ASSERT_EQ(value, "Directly photographed");
199 }
200 
201 HWTEST_F(ExifMetadataTest, GetValue012, TestSize.Level3)
202 {
203     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
204     ASSERT_NE(exifData, nullptr);
205     std::string value;
206     ExifMetadata metadata(exifData);
207     ASSERT_TRUE(metadata.SetValue("ISOSpeedRatings", "160"));
208     metadata.GetValue("ISOSpeedRatings", value);
209     ASSERT_EQ(value, "160");
210 }
211 
212 HWTEST_F(ExifMetadataTest, GetValue013, TestSize.Level3)
213 {
214     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
215     ASSERT_NE(exifData, nullptr);
216     std::string value;
217     ExifMetadata metadata(exifData);
218     ASSERT_TRUE(metadata.SetValue("FNumber", "3/1"));
219     metadata.GetValue("FNumber", value);
220     ASSERT_EQ(value, "f/3.0");
221 }
222 
223 HWTEST_F(ExifMetadataTest, GetValue014, TestSize.Level3)
224 {
225     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
226     ASSERT_NE(exifData, nullptr);
227     std::string value;
228     ExifMetadata metadata(exifData);
229     ASSERT_TRUE(metadata.SetValue("DateTime", "2024:01:25 05:51:34"));
230     metadata.GetValue("DateTime", value);
231     ASSERT_EQ(value, "2024:01:25 05:51:34");
232 }
233 
234 HWTEST_F(ExifMetadataTest, GetValue015, TestSize.Level3)
235 {
236     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
237     ASSERT_NE(exifData, nullptr);
238     std::string value;
239     ExifMetadata metadata(exifData);
240     ASSERT_TRUE(metadata.SetValue("GPSTimeStamp", "11:37:56"));
241     metadata.GetValue("GPSTimeStamp", value);
242     ASSERT_EQ(value, "11:37:56.00");
243 }
244 
245 HWTEST_F(ExifMetadataTest, GetValue016, TestSize.Level3)
246 {
247     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
248     ASSERT_NE(exifData, nullptr);
249     std::string value;
250     ExifMetadata metadata(exifData);
251     ASSERT_TRUE(metadata.SetValue("ImageDescription", "_cuva"));
252     metadata.GetValue("ImageDescription", value);
253     ASSERT_EQ(value, "_cuva");
254 }
255 
256 HWTEST_F(ExifMetadataTest, GetValue017, TestSize.Level3)
257 {
258     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
259     ASSERT_NE(exifData, nullptr);
260     std::string value;
261     ExifMetadata metadata(exifData);
262     ASSERT_TRUE(metadata.SetValue("Model", "TNY-AL00"));
263     metadata.GetValue("Model", value);
264     ASSERT_EQ(value, "TNY-AL00");
265 }
266 
267 HWTEST_F(ExifMetadataTest, GetValue018, TestSize.Level3)
268 {
269     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
270     ASSERT_NE(exifData, nullptr);
271     std::string value;
272     ExifMetadata metadata(exifData);
273     ASSERT_TRUE(metadata.SetValue("SensitivityType", "5"));
274     metadata.GetValue("SensitivityType", value);
275     ASSERT_EQ(value, "Standard output sensitivity (SOS) and ISO speed");
276 }
277 
278 HWTEST_F(ExifMetadataTest, GetValue019, TestSize.Level3)
279 {
280     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
281     ASSERT_NE(exifData, nullptr);
282     std::string value;
283     ExifMetadata metadata(exifData);
284     ASSERT_TRUE(metadata.SetValue("StandardOutputSensitivity", "5"));
285     metadata.GetValue("StandardOutputSensitivity", value);
286     ASSERT_EQ(value, "5");
287 }
288 
289 HWTEST_F(ExifMetadataTest, GetValue020, TestSize.Level3)
290 {
291     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
292     ASSERT_NE(exifData, nullptr);
293     std::string value;
294     ExifMetadata metadata(exifData);
295     ASSERT_TRUE(metadata.SetValue("RecommendedExposureIndex", "241"));
296     metadata.GetValue("RecommendedExposureIndex", value);
297     ASSERT_EQ(value, "241");
298 }
299 
300 HWTEST_F(ExifMetadataTest, GetValue021, TestSize.Level3)
301 {
302     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
303     ASSERT_NE(exifData, nullptr);
304     std::string value;
305     ExifMetadata metadata(exifData);
306     ASSERT_TRUE(metadata.SetValue("ISOSpeedRatings", "160"));
307     metadata.GetValue("ISOSpeedRatings", value);
308     ASSERT_EQ(value, "160");
309 }
310 
311 HWTEST_F(ExifMetadataTest, GetValue022, TestSize.Level3)
312 {
313     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
314     ASSERT_NE(exifData, nullptr);
315     std::string value;
316     ExifMetadata metadata(exifData);
317     ASSERT_TRUE(metadata.SetValue("ApertureValue", "4/1"));
318     metadata.GetValue("ApertureValue", value);
319     ASSERT_EQ(value, "4.00 EV (f/4.0)");
320 }
321 
322 HWTEST_F(ExifMetadataTest, GetValue023, TestSize.Level3)
323 {
324     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
325     ASSERT_NE(exifData, nullptr);
326     std::string value;
327     ExifMetadata metadata(exifData);
328     ASSERT_TRUE(metadata.SetValue("ExposureBiasValue", "23/1"));
329     metadata.GetValue("ExposureBiasValue", value);
330     ASSERT_EQ(value, "23.00 EV");
331 }
332 
333 HWTEST_F(ExifMetadataTest, GetValue024, TestSize.Level3)
334 {
335     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
336     ASSERT_NE(exifData, nullptr);
337     std::string value;
338     ExifMetadata metadata(exifData);
339     ASSERT_TRUE(metadata.SetValue("MeteringMode", "5"));
340     metadata.GetValue("MeteringMode", value);
341     ASSERT_EQ(value, "Pattern");
342 }
343 
344 HWTEST_F(ExifMetadataTest, GetValue025, TestSize.Level3)
345 {
346     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
347     ASSERT_NE(exifData, nullptr);
348     std::string value;
349     ExifMetadata metadata(exifData);
350     ASSERT_TRUE(metadata.SetValue("LightSource", "2"));
351     metadata.GetValue("LightSource", value);
352     ASSERT_EQ(value, "Fluorescent");
353 }
354 
355 HWTEST_F(ExifMetadataTest, GetValue026, TestSize.Level3)
356 {
357     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
358     ASSERT_NE(exifData, nullptr);
359     std::string value;
360     ExifMetadata metadata(exifData);
361     ASSERT_TRUE(metadata.SetValue("Flash", "5"));
362     metadata.GetValue("Flash", value);
363     ASSERT_EQ(value, "Strobe return light not detected");
364 }
365 
366 HWTEST_F(ExifMetadataTest, GetValue027, TestSize.Level3)
367 {
368     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
369     ASSERT_NE(exifData, nullptr);
370     std::string value;
371     ExifMetadata metadata(exifData);
372     ASSERT_TRUE(metadata.SetValue("FocalLength", "31/1"));
373     metadata.GetValue("FocalLength", value);
374     ASSERT_EQ(value, "31.0 mm");
375 }
376 
377 HWTEST_F(ExifMetadataTest, GetValue028, TestSize.Level3)
378 {
379     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
380     ASSERT_NE(exifData, nullptr);
381     std::string value;
382     ExifMetadata metadata(exifData);
383     ASSERT_TRUE(metadata.SetValue("UserComment", "comm2"));
384     metadata.GetValue("UserComment", value);
385     ASSERT_EQ(value, "comm2");
386 }
387 
388 HWTEST_F(ExifMetadataTest, GetValue029, TestSize.Level3)
389 {
390     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
391     ASSERT_NE(exifData, nullptr);
392     std::string value;
393     ExifMetadata metadata(exifData);
394     ASSERT_TRUE(metadata.SetValue("PixelXDimension", "1000"));
395     metadata.GetValue("PixelXDimension", value);
396     ASSERT_EQ(value, "1000");
397 }
398 
399 HWTEST_F(ExifMetadataTest, GetValue030, TestSize.Level3)
400 {
401     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
402     ASSERT_NE(exifData, nullptr);
403     std::string value;
404     ExifMetadata metadata(exifData);
405     ASSERT_TRUE(metadata.SetValue("PixelYDimension", "2000"));
406     metadata.GetValue("PixelYDimension", value);
407     ASSERT_EQ(value, "2000");
408 }
409 
410 HWTEST_F(ExifMetadataTest, GetValue031, TestSize.Level3)
411 {
412     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
413     ASSERT_NE(exifData, nullptr);
414     std::string value;
415     ExifMetadata metadata(exifData);
416     ASSERT_TRUE(metadata.SetValue("WhiteBalance", "1"));
417     metadata.GetValue("WhiteBalance", value);
418     ASSERT_EQ(value, "Manual white balance");
419 }
420 
421 HWTEST_F(ExifMetadataTest, GetValue032, TestSize.Level3)
422 {
423     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
424     ASSERT_NE(exifData, nullptr);
425     std::string value;
426     ExifMetadata metadata(exifData);
427     ASSERT_TRUE(metadata.SetValue("FocalLengthIn35mmFilm", "2"));
428     metadata.GetValue("FocalLengthIn35mmFilm", value);
429     ASSERT_EQ(value, "2");
430 }
431 
432 HWTEST_F(ExifMetadataTest, GetValue033, TestSize.Level3)
433 {
434     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_HW_PATH.c_str());
435     ASSERT_NE(exifData, nullptr);
436     std::string value;
437     ExifMetadata metadata(exifData);
438     metadata.GetValue("HwMnoteScenePointer", value);
439     ASSERT_EQ(value, "256");
440     metadata.GetValue("HwMnoteSceneVersion", value);
441     ASSERT_EQ(value, "1");
442     metadata.GetValue("HwMnoteSceneFoodConf", value);
443     ASSERT_EQ(value, "2");
444     metadata.GetValue("HwMnoteSceneStageConf", value);
445     ASSERT_EQ(value, "3");
446     metadata.GetValue("HwMnoteSceneBlueSkyConf", value);
447     ASSERT_EQ(value, "4");
448     metadata.GetValue("HwMnoteSceneGreenPlantConf", value);
449     ASSERT_EQ(value, "5");
450     metadata.GetValue("HwMnoteSceneBeachConf", value);
451     ASSERT_EQ(value, "6");
452     metadata.GetValue("HwMnoteSceneSnowConf", value);
453     ASSERT_EQ(value, "7");
454     metadata.GetValue("HwMnoteSceneSunsetConf", value);
455     ASSERT_EQ(value, "8");
456     metadata.GetValue("HwMnoteSceneFlowersConf", value);
457     ASSERT_EQ(value, "9");
458     metadata.GetValue("HwMnoteSceneNightConf", value);
459     ASSERT_EQ(value, "10");
460     metadata.GetValue("HwMnoteSceneTextConf", value);
461     ASSERT_EQ(value, "11");
462 }
463 
464 HWTEST_F(ExifMetadataTest, GetValue034, TestSize.Level3)
465 {
466     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_HW_PATH.c_str());
467     ASSERT_NE(exifData, nullptr);
468     std::string value;
469     ExifMetadata metadata(exifData);
470     metadata.GetValue("HwMnoteFacePointer", value);
471     ASSERT_EQ(value, "122");
472     metadata.GetValue("HwMnoteFaceVersion", value);
473     ASSERT_EQ(value, "1");
474     metadata.GetValue("HwMnoteFaceCount", value);
475     ASSERT_EQ(value, "2");
476     metadata.GetValue("HwMnoteFaceConf", value);
477     ASSERT_EQ(value, "3");
478     metadata.GetValue("HwMnoteFaceSmileScore", value);
479     ASSERT_EQ(value, "1 2 3 4 5 6 7 8");
480     metadata.GetValue("HwMnoteFaceRect", value);
481     ASSERT_EQ(value, "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8");
482     metadata.GetValue("HwMnoteFaceLeyeCenter", value);
483     ASSERT_EQ(value, "1 2 3 4");
484     metadata.GetValue("HwMnoteFaceReyeCenter", value);
485     ASSERT_EQ(value, "5 6 7 8");
486     metadata.GetValue("HwMnoteFaceMouthCenter", value);
487     ASSERT_EQ(value, "1 2 3 4 5 6 7 8");
488     metadata.GetValue("HwMnoteCaptureMode", value);
489     ASSERT_EQ(value, "1");
490     metadata.GetValue("HwMnoteBurstNumber", value);
491     ASSERT_EQ(value, "2");
492     metadata.GetValue("HwMnoteFrontCamera", value);
493     ASSERT_EQ(value, "3");
494     metadata.GetValue("HwMnoteRollAngle", value);
495     ASSERT_EQ(value, "4");
496     metadata.GetValue("HwMnotePitchAngle", value);
497     ASSERT_EQ(value, "5");
498     metadata.GetValue("HwMnotePhysicalAperture", value);
499     ASSERT_EQ(value, "6");
500     metadata.GetValue("HwMnoteFocusMode", value);
501     ASSERT_EQ(value, "7");
502 }
503 
504 HWTEST_F(ExifMetadataTest, GetValue035, TestSize.Level3)
505 {
506     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_HW_PATH.c_str());
507     ASSERT_NE(exifData, nullptr);
508     std::string value;
509     ExifMetadata metadata(exifData);
510     ASSERT_NE(metadata.GetValue("notexistkey", value), SUCCESS);
511 }
512 
513 HWTEST_F(ExifMetadataTest, SetValueBatch001, TestSize.Level3)
514 {
515     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
516     ASSERT_NE(exifData, nullptr);
517     ExifMetadata metadata(exifData);
518     ASSERT_TRUE(metadata.SetValue("BitsPerSample", "9,9,8"));
519     ASSERT_TRUE(metadata.SetValue("Orientation", "1"));
520     ASSERT_TRUE(metadata.SetValue("ImageLength", "1000"));
521     ASSERT_TRUE(metadata.SetValue("ImageWidth", "1001"));
522     ASSERT_TRUE(metadata.SetValue("GPSLatitude", "39,54,20"));
523     ASSERT_TRUE(metadata.SetValue("GPSLongitude", "120,52,26"));
524     ASSERT_TRUE(metadata.SetValue("GPSLatitudeRef", "N"));
525     ASSERT_TRUE(metadata.SetValue("GPSLongitudeRef", "E"));
526     ASSERT_TRUE(metadata.SetValue("WhiteBalance", "1"));
527     ASSERT_TRUE(metadata.SetValue("FocalLengthIn35mmFilm", "2"));
528     ASSERT_TRUE(metadata.SetValue("Flash", "5"));
529     ASSERT_TRUE(metadata.SetValue("ApertureValue", "4/1"));
530     ASSERT_TRUE(metadata.SetValue("DateTimeOriginal", "2024:01:25 05:51:34"));
531     ASSERT_TRUE(metadata.SetValue("DateTime", "2024:01:25 05:51:34"));
532     ASSERT_TRUE(metadata.SetValue("ExposureBiasValue", "23/1"));
533     ASSERT_TRUE(metadata.SetValue("ExposureTime", "1/34"));
534     ASSERT_TRUE(metadata.SetValue("FNumber", "3/1"));
535     ASSERT_TRUE(metadata.SetValue("FocalLength", "31/1"));
536     ASSERT_TRUE(metadata.SetValue("GPSTimeStamp", "11:37:56"));
537     ASSERT_TRUE(metadata.SetValue("GPSDateStamp", "2024:01:25"));
538     ASSERT_TRUE(metadata.SetValue("ImageDescription", "_cuva"));
539     ASSERT_TRUE(metadata.SetValue("ISOSpeedRatings", "160"));
540     ASSERT_TRUE(metadata.SetValue("ISOSpeedRatings", "160"));
541     ASSERT_TRUE(metadata.SetValue("LightSource", "2"));
542     ASSERT_TRUE(metadata.SetValue("Make", "5"));
543     ASSERT_TRUE(metadata.SetValue("MeteringMode", "5"));
544     ASSERT_TRUE(metadata.SetValue("Model", "TNY-AL00"));
545     ASSERT_TRUE(metadata.SetValue("PixelXDimension", "1000"));
546     ASSERT_TRUE(metadata.SetValue("PixelYDimension", "2000"));
547     ASSERT_TRUE(metadata.SetValue("RecommendedExposureIndex", "241"));
548     ASSERT_TRUE(metadata.SetValue("SceneType", "1"));
549     ASSERT_TRUE(metadata.SetValue("SensitivityType", "5"));
550     ASSERT_TRUE(metadata.SetValue("StandardOutputSensitivity", "5"));
551     ASSERT_TRUE(metadata.SetValue("UserComment", "comm"));
552     ASSERT_TRUE(metadata.SetValue("JPEGProc", "252"));
553     ASSERT_TRUE(metadata.SetValue("Compression", "6"));
554     ASSERT_TRUE(metadata.SetValue("PhotometricInterpretation", "0"));
555     ASSERT_TRUE(metadata.SetValue("StripOffsets", "11"));
556     ASSERT_TRUE(metadata.SetValue("SamplesPerPixel", "23"));
557     ASSERT_TRUE(metadata.SetValue("RowsPerStrip", "252"));
558     ASSERT_TRUE(metadata.SetValue("StripByteCounts", "252"));
559 }
560 
561 HWTEST_F(ExifMetadataTest, SetValueBatch002, TestSize.Level3)
562 {
563     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_PATH.c_str());
564     ASSERT_NE(exifData, nullptr);
565     ExifMetadata metadata(exifData);
566     ASSERT_TRUE(metadata.SetValue("XResolution", "72/1"));
567     ASSERT_TRUE(metadata.SetValue("YResolution", "252/1"));
568     ASSERT_TRUE(metadata.SetValue("PlanarConfiguration", "1"));
569     ASSERT_TRUE(metadata.SetValue("ResolutionUnit", "2"));
570     ASSERT_TRUE(metadata.SetValue("TransferFunction", "2"));
571     ASSERT_TRUE(metadata.SetValue("Software", "MNA-AL00 4.0.0.120(C00E116R3P7)"));
572     ASSERT_TRUE(metadata.SetValue("Artist", "Joseph.Xu"));
573     ASSERT_TRUE(metadata.SetValue("WhitePoint", "252/1"));
574     ASSERT_TRUE(metadata.SetValue("PrimaryChromaticities", "124/1"));
575     ASSERT_TRUE(metadata.SetValue("YCbCrCoefficients", "299/1000 587/1000 114/1000"));
576     ASSERT_TRUE(metadata.SetValue("YCbCrSubSampling", "3 2"));
577     ASSERT_TRUE(metadata.SetValue("YCbCrPositioning", "1"));
578     ASSERT_TRUE(metadata.SetValue("ReferenceBlackWhite", "221/1"));
579     ASSERT_TRUE(metadata.SetValue("Copyright", "Hw"));
580     ASSERT_TRUE(metadata.SetValue("ExposureProgram", "2"));
581     ASSERT_TRUE(metadata.SetValue("SpectralSensitivity", "sensitivity"));
582     ASSERT_TRUE(metadata.SetValue("OECF", "45"));
583     ASSERT_TRUE(metadata.SetValue("ExifVersion", "0210"));
584     ASSERT_TRUE(metadata.SetValue("DateTimeDigitized", "2023:01:19 10:39:58"));
585     ASSERT_TRUE(metadata.SetValue("ComponentsConfiguration", "1456"));
586     ASSERT_TRUE(metadata.SetValue("ShutterSpeedValue", "13/1"));
587     ASSERT_TRUE(metadata.SetValue("BrightnessValue", "13/1"));
588     ASSERT_TRUE(metadata.SetValue("MaxApertureValue", "1/12"));
589     ASSERT_TRUE(metadata.SetValue("SubjectDistance", "25/1"));
590     ASSERT_TRUE(metadata.SetValue("SubjectArea", "10 20"));
591     ASSERT_TRUE(metadata.SetValue("SubsecTime", "427000"));
592     ASSERT_TRUE(metadata.SetValue("SubsecTimeOriginal", "427000"));
593     ASSERT_TRUE(metadata.SetValue("SubsecTimeDigitized", "427000"));
594     ASSERT_TRUE(metadata.SetValue("FlashpixVersion", "1"));
595     ASSERT_TRUE(metadata.SetValue("ColorSpace", "1"));
596     ASSERT_TRUE(metadata.SetValue("RelatedSoundFile", "/usr/home/sound/sea.wav"));
597 }
598 
599 std::string g_modifyData[][3] = {
600     {"BitsPerSample", "9 9 8", "9, 9, 8"},
601     {"BitsPerSample", "9, 9, 8", "9, 9, 8"},
602     {"BitsPerSample", "9,9,8", "9, 9, 8"},
603     {"Orientation", "1", "Top-left"},
604     {"Orientation", "4", "Bottom-left"},
605     {"ImageLength", "1000", "1000"},
606     {"ImageWidth", "1001", "1001"},
607     {"GPSLatitude", "114,3", "38.0,  0,  0"},
608     {"GPSLatitude", "39,54,20", "39, 54, 20"},
609     {"GPSLatitude", "39/1 54/1 20/1", "39, 54, 20"},
610     {"GPSLongitude", "120,52,26", "120, 52, 26"},
611     {"GPSLatitudeRef", "N", "N"},
612     {"GPSLongitudeRef", "E", "E"},
613     {"DateTimeOriginal", "2024:01:25 05:51:34", "2024:01:25 05:51:34"},
614     {"ExposureTime", "1/34", "1/34 sec."},
615     {"ExposureTime", "1/3", "1/3 sec."},
616     {"SceneType", "1", "Directly photographed"},
617     {"ISOSpeedRatings", "160", "160"},
618     {"FNumber", "3/1", "f/3.0"},
619     {"DateTime", "2024:01:25 05:51:34", "2024:01:25 05:51:34"},
620     {"DateTime", "2024:01:25", "2024:01:25"},
621     {"GPSTimeStamp", "11/1 37/1 56/1", "11:37:56.00"},
622     {"GPSDateStamp", "2023:10:19", "2023:10:19"},
623     {"ImageDescription", "_cuva", "_cuva"},
624     {"Make", "XiaoMI", "XiaoMI"},
625     {"Model", "TNY-AL00", "TNY-AL00"},
626     {"PhotoMode", "252", "252"},
627     {"SensitivityType", "5", "Standard output sensitivity (SOS) and ISO speed"},
628     {"StandardOutputSensitivity", "5", "5"},
629     {"RecommendedExposureIndex", "241", "241"},
630     {"ISOSpeed", "1456", "1456"},
631     {"ApertureValue", "4/1", "4.00 EV (f/4.0)"},
632     {"ExposureBiasValue", "23/1", "23.00 EV"},
633     {"MeteringMode", "5", "Pattern"},
634     {"LightSource", "2", "Fluorescent"},
635     {"Flash", "5", "Strobe return light not detected"},
636     {"FocalLength", "31/1", "31.0 mm"},
637     {"UserComment", "comm", "comm"},
638     {"PixelXDimension", "1000", "1000"},
639     {"PixelYDimension", "2000", "2000"},
640     {"WhiteBalance", "1", "Manual white balance"},
641     {"FocalLengthIn35mmFilm", "2", "2"},
642     {"CompressedBitsPerPixel", "24/1", "24"},
643     {"JPEGProc", "252", "252"},
644     {"Compression", "6", "JPEG compression"},
645     {"PhotometricInterpretation", "0", "Reversed mono"},
646     {"StripOffsets", "11", "11"},
647     {"SamplesPerPixel", "23", "23"},
648     {"RowsPerStrip", "252", "252"},
649     {"StripByteCounts", "252", "252"},
650     {"XResolution", "72/1", "72"},
651     {"YResolution", "252/1", "252"},
652     {"PlanarConfiguration", "1", "Chunky format"},
653     {"ResolutionUnit", "2", "Inch"},
654     {"TransferFunction", "2", "1 bytes undefined data"},
655     {"Software", "MNA-AL00 4.0.0.120(C00E116R3P7)", "MNA-AL00 4.0.0.120(C00E116R3P7)"},
656     {"Artist", "Joseph.Xu", "Joseph.Xu"},
657     {"WhitePoint", "252/1", "252, 0/0"},
658     {"PrimaryChromaticities", "124/1", "124"},
659     {"YCbCrCoefficients", "299/1000 587/1000 114/1000", "0.299, 0.587, 0.114"},
660     {"YCbCrSubSampling", "3 2", "3, 2"},
661     {"YCbCrPositioning", "1", "Centered"},
662     {"ReferenceBlackWhite", "222 0 1.5 0 25.2 25.2", "222,  0, 1.5,  0, 25.2, 25.2"},
663     {"Copyright", "Hw", "Hw (Photographer) - [None] (Editor)"},
664     {"SubsecTime", "427000", "427000"},
665     {"SubsecTimeOriginal", "427000", "427000"},
666     {"SubsecTimeDigitized", "427000", "427000"},
667     {"FlashpixVersion", "0100", "FlashPix Version 1.0"},
668     {"ColorSpace", "2", "Adobe RGB"},
669     {"RelatedSoundFile", "/usr/home/sound/sea.wav", "/usr/home/sound/sea.wav"},
670     {"FlashEnergy", "832/1", "832"},
671     {"SpatialFrequencyResponse", "13", "13"},
672     {"FocalPlaneXResolution", "1080/1", "1080"},
673     {"FocalPlaneYResolution", "880/1", "880"},
674     {"FocalPlaneResolutionUnit", "3", "Centimeter"},
675     {"SubjectLocation", "3 12", "3, 12"},
676     {"ExposureIndex", "3/2", "1.5"},
677     {"SensingMethod", "3", "Two-chip color area sensor"},
678     {"FileSource", "3", "DSC"},
679     {"CFAPattern", "3", "1 bytes undefined data"},
680     {"CustomRendered", "1", "Custom process"},
681     {"ExposureMode", "0", "Auto exposure"},
682     {"DigitalZoomRatio", "321/1", "321"},
683     {"SceneCaptureType", "0", "Standard"},
684     {"GainControl", "0", "Normal"},
685     {"Contrast", "0", "Normal"},
686     {"Saturation", "0", "Normal"},
687     {"Sharpness", "0", "Normal"},
688     {"DeviceSettingDescription", "2xxx", "2xxx"},
689     {"SubjectDistanceRange", "0", "Unknown"},
690     {"ImageUniqueID", "FXIC012", "FXIC012"},
691     {"GPSVersionID", "2.2.0.0", "2.2.0.0"},
692     {"GPSAltitudeRef", "1", "Sea level reference"},
693     {"GPSAltitude", "0/100", "0.00"},
694     {"GPSSatellites", "xxx", "xxx"},
695     {"GPSStatus", "A", "A"},
696     {"GPSMeasureMode", "2", "2"},
697     {"GPSDOP", "182/1", "182"},
698     {"GPSSpeedRef", "K", "K"},
699     {"GPSSpeed", "150/1", "150"},
700     {"GPSTrackRef", "T", "T"},
701     {"GPSTrack", "114/3", "38.0"},
702     {"GPSImgDirectionRef", "M", "M"},
703     {"GPSImgDirection", "125/56", "2.23"},
704     {"GPSMapDatum", "xxxx", "xxxx"},
705     {"GPSDestLatitudeRef", "N", "N"},
706     {"GPSDestLatitude", "33/1 22/1 11/1", "33, 22, 11"},
707     {"GPSDestLongitudeRef", "E", "E"},
708     {"GPSDestLongitude", "33/1 22/1 11/1", "33, 22, 11"},
709     {"GPSDestBearingRef", "T", "T"},
710     {"GPSDestBearing", "22/11", "2.0"},
711     {"GPSDestDistanceRef", "N", "N"},
712     {"GPSDestDistance", "10/1", "10"},
713     {"GPSProcessingMethod", "CELLID", "CELLID"},
714     {"GPSAreaInformation", "arexxx", "arexxx"},
715     {"GPSDifferential", "0", "0"},
716     {"ComponentsConfiguration", "1456", "Y R G B"},
717     {"ISOSpeedLatitudeyyy", "1456", "1456"},
718     {"ISOSpeedLatitudezzz", "1456", "1456"},
719     {"SubjectDistance", "5/2", "2.5 m"},
720     {"DefaultCropSize", "153 841", "153, 841"},
721     {"LensSpecification", "3/4 5/2 3/2 1/2", "0.8, 2.5, 1.5, 0.5"},
722     {"SubjectArea", "12 13", "(x,y) = (12,13)"},
723     {"DNGVersion", "2 2 3 1", "2, 2, 3, 1"},
724     {"SubfileType", "2", "2"},
725     {"NewSubfileType", "3", "3"},
726     {"LensMake", "xxwx", "xxwx"},
727     {"LensModel", "txaw", "txaw"},
728     {"LensSerialNumber", "qxhc", "qxhc"},
729     {"OffsetTimeDigitized", "cfh", "cfh"},
730     {"OffsetTimeOriginal", "chex", "chex"},
731     {"SourceExposureTimesOfCompositeImage", "xxxw", "xxxw"},
732     {"SourceImageNumberOfCompositeImage", "23 34", "23, 34"},
733     {"GPSHPositioningError", "5/2", "2.5"},
734     {"Orientation", "4", "Bottom-left"},
735     {"GPSLongitudeRef", "W", "W"},
736     {"ExposureProgram", "7", "Portrait mode (for closeup photos with the background out of focus)"},
737     {"SpectralSensitivity", "xxd", "xxd"},
738     {"OECF", "excc", "4 bytes undefined data"},
739     {"ExifVersion", "0110", "Exif Version 1.1"},
740     {"DateTimeDigitized", "2024:01:25 05:51:34", "2024:01:25 05:51:34"},
741     {"ShutterSpeedValue", "5/2", "2.50 EV (1/6 sec.)"},
742     {"BrightnessValue", "5/2", "2.50 EV (19.38 cd/m^2)"},
743     {"MaxApertureValue", "5/2", "2.50 EV (f/2.4)"},
744     {"BodySerialNumber", "exoch", "exoch"},
745     {"CameraOwnerName", "c.uec", "c.uec"},
746     {"CompositeImage", "2", "2"},
747     {"Gamma", "5/2", "2.5"},
748     {"OffsetTime", "2024:01:25", "2024:01:25"},
749 };
750 
751 HWTEST_F(ExifMetadataTest, SetValueBatch003, TestSize.Level3)
752 {
753     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_BLANKEXIF_PATH.c_str());
754     ASSERT_NE(exifData, nullptr);
755 
756     std::string value;
757     ExifMetadata metadata(exifData);
758 
759     int rows = sizeof(g_modifyData) / sizeof(g_modifyData[0]);
760     for (int i = 0; i < rows; ++i) {
761         std::string key = g_modifyData[i][0];
762         std::string modifyvalue = g_modifyData[i][1];
763         ASSERT_TRUE(metadata.SetValue(key, modifyvalue));
764 
765         std::string retvalue;
766         metadata.GetValue(key, retvalue);
767         ASSERT_EQ(retvalue, g_modifyData[i][2]);
768     }
769 }
770 
771 std::string g_dirtData[][2] = {
772     {"BitsPerSample", "abc,4"},
773     {"DateTimeOriginal", "202:01:25 05:51:34"},
774     {"TransferFunction", "3 bytes undefined data"},
775     {"OECF", "2 bytes undefined data"},
776     {"FileSource", "Internal error (unknown value 4)"},
777     {"CFAPattern", "2 bytes undefined data"},
778     {"TransferFunction", "3 bytes undefined data"},
779     {"OECF", "4 bytes undefined data"},
780     {"CFAPattern", "1 bytes undefined data"},
781 };
782 
783 HWTEST_F(ExifMetadataTest, SetValueBatch004, TestSize.Level3)
784 {
785     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_BLANKEXIF_PATH.c_str());
786     ASSERT_NE(exifData, nullptr);
787 
788     std::string value;
789     ExifMetadata metadata(exifData);
790 
791     int rows = sizeof(g_dirtData) / sizeof(g_dirtData[0]);
792     for (int i = 0; i < rows; ++i) {
793         std::string key = g_dirtData[i][0];
794         std::string modifyvalue = g_dirtData[i][1];
795         ASSERT_NE(metadata.SetValue(key, modifyvalue), true);
796     }
797 }
798 
799 
800 std::string g_batchData006[][3] = {
801     {"BitsPerSample", "65535,65535,65535", "65535, 65535, 65535"},
802     {"Orientation", "8", "Left-bottom"},
803     {"ImageLength", "65535", "65535"},
804     {"ImageWidth", "65535", "65535"},
805     {"GPSLatitude", "114,3", "38.0,  0,  0"},
806     {"GPSLongitude", "114,3", "38.0,  0,  0"},
807     {"GPSLatitudeRef", "S", "S"},
808     {"GPSLongitudeRef", "W", "W"},
809     {"DateTimeOriginal", "1900:01:01 00:00:00", "1900:01:01 00:00:00"},
810     {"ExposureTime", "1/60", "1/60 sec."},
811     {"ISOSpeedRatings", "65535", "65535"},
812     {"FNumber", "1/30", "f/0.0"},
813     {"DateTime", "1900:01:01", "1900:01:01"},
814     {"GPSTimeStamp", "12 54 20", "12:54:20.00"},
815     {"GPSDateStamp", "1900:01:01", "1900:01:01"},
816     {"ImageDescription", "@  @", "@  @"},
817     {"Make", "APPLE", "APPLE"},
818     {"Model", "%s \\0", "%s \\0"},
819     {"PhotoMode", "13", "13"},
820     {"JPEGProc", "13", "13"},
821     {"SensitivityType", "0", "Unknown"},
822     {"StandardOutputSensitivity", "1000", "1000"},
823     {"RecommendedExposureIndex", "2147483647", "2147483647"},
824     {"ISOSpeedRatings", "65535", "65535"},
825     {"ISOSpeed", "65535", "65535"},
826     {"ApertureValue", "16", "16.00 EV (f/256.0)"},
827     {"ExposureBiasValue", "4", "4.00 EV"},
828     {"MeteringMode", "0", "Unknown"},
829     {"LightSource", "2", "Fluorescent"},
830     {"Flash", "95", "Flash fired, auto mode, return light detected, red-eye reduction mode"},
831     {"FocalLength", "31/1", "31.0 mm"},
832     {"UserComment", "%s \\0", "%s \\0"},
833     {"PixelXDimension", "0", "0"},
834     {"PixelYDimension", "0", "0"},
835     {"WhiteBalance", "0", "Auto white balance"},
836     {"FocalLengthIn35mmFilm", "12", "12"},
837     {"Compression", "32773", "PackBits compression"},
838     {"PhotometricInterpretation", "1", "Normal mono"},
839     {"StripOffsets", "456", "456"},
840     {"SamplesPerPixel", "65535", "65535"},
841     {"RowsPerStrip", "345", "345"},
842     {"StripByteCounts", "345", "345"},
843     {"XResolution", "31/1", "31"},
844     {"YResolution", "31/1", "31"},
845     {"PlanarConfiguration", "2", "Planar format"},
846     {"ResolutionUnit", "3", "Centimeter"},
847     {"TransferFunction", "123", "3 bytes undefined data"},
848     {"Software", "%s \\0", "%s \\0"},
849     {"Artist", "%s \\0", "%s \\0"},
850     {"WhitePoint", "31/1", "31, 0/0"},
851     {"PrimaryChromaticities", "31/1", "31"},
852     {"YCbCrCoefficients", "3/2 4/2 9/3", "1.5, 2.0, 3.0"},
853     {"YCbCrSubSampling", "4 5", "4, 5"},
854     {"YCbCrPositioning", "2", "Co-sited"},
855     {"ReferenceBlackWhite", "3", " 3, 255,  0, 255,  0, 255"},
856     {"Copyright", "joseph", "joseph (Photographer) - [None] (Editor)"},
857     {"ExposureProgram", "8", "Landscape mode (for landscape photos with the background in focus)"},
858     {"SpectralSensitivity", "1234", "1234"},
859     {"OECF", "ab", "2 bytes undefined data"},
860     {"ExifVersion", "0120", "Exif Version 1.2"},
861     {"DateTimeDigitized", "1900:01:01 00:00:00", "1900:01:01 00:00:00"},
862     {"ComponentsConfiguration", "1256", "Y Cb G B"},
863     {"ShutterSpeedValue", "3/2", "1.50 EV (1/3 sec.)"},
864     {"BrightnessValue", "6/5", "1.20 EV (7.87 cd/m^2)"},
865     {"MaxApertureValue", "8/5", "1.60 EV (f/1.7)"},
866     {"SubjectDistance", "1/2", "0.5 m"},
867     {"SubjectArea", "45 23", "(x,y) = (45,23)"},
868     {"SubsecTime", "427000", "427000"},
869     {"SubsecTimeOriginal", "123456", "123456"},
870     {"SubsecTimeDigitized", "999999", "999999"},
871     {"FlashpixVersion", "0101", "FlashPix Version 1.01"},
872     {"ColorSpace", "2", "Adobe RGB"},
873     {"RelatedSoundFile", "abc", "abc"},
874     {"FlashEnergy", "5/2", "2.5"},
875     {"SpatialFrequencyResponse", "corn", "corn"},
876     {"FocalPlaneXResolution", "102/1", "102"},
877     {"FocalPlaneYResolution", "81/1", "81"},
878     {"FocalPlaneResolutionUnit", "3", "Centimeter"},
879     {"SubjectLocation", "23 112", "23, 112"},
880     {"ExposureIndex", "5/2", "2.5"},
881     {"SensingMethod", "8", "Color sequential linear sensor"},
882     {"FileSource", "4", "Internal error (unknown value 4)"},
883     {"CFAPattern", "ab", "2 bytes undefined data"},
884     {"CustomRendered", "1", "Custom process"},
885     {"ExposureMode", "2", "Auto bracket"},
886     {"DigitalZoomRatio", "23/1", "23"},
887     {"SceneCaptureType", "3", "Night scene"},
888     {"GainControl", "4", "High gain down"},
889     {"Contrast", "2", "Hard"},
890     {"Saturation", "2", "High saturation"},
891     {"Sharpness", "2", "Hard"},
892     {"DeviceSettingDescription", "coxex", "coxex"},
893     {"SubjectDistanceRange", "3", "Distant view"},
894     {"ImageUniqueID", "xxx", "xxx"},
895     {"GPSVersionID", "2.2.0.1", "2.2.0.1"},
896     {"GPSAltitudeRef", "1", "Sea level reference"},
897     {"GPSAltitude", "100/100", "1.00"},
898     {"GPSSatellites", "a b c", "a b c"},
899     {"GPSStatus", "V", "V"},
900     {"GPSMeasureMode", "3", "3"},
901     {"GPSDOP", "100/100", "1.00"},
902     {"GPSSpeedRef", "K", "K"},
903     {"GPSSpeed", "0/1", " 0"},
904     {"GPSTrackRef", "M", "M"},
905     {"GPSTrack", "3.5", "3.5"},
906     {"GPSImgDirectionRef", "T", "T"},
907     {"GPSImgDirection", "2.5", "2.5"},
908     {"GPSMapDatum", "%s\\0", "%s\\0"},
909     {"GPSDestLatitudeRef", "S", "S"},
910     {"GPSDestLatitude", "0/1 0/1 0/1", " 0,  0,  0"},
911     {"GPSDestLongitudeRef", "W", "W"},
912     {"GPSDestLongitude", "0/1 0/1 0/1", " 0,  0,  0"},
913     {"GPSDestBearingRef", "M", "M"},
914     {"GPSDestBearing", "2.5", "2.5"},
915     {"GPSDestDistanceRef", "K", "K"},
916     {"GPSDestDistance", "2.5", "2.5"},
917     {"GPSProcessingMethod", "XXX", "XXX"},
918     {"GPSAreaInformation", "client", "client"},
919     {"GPSDifferential", "1", "1"},
920     {"BodySerialNumber", "xoinc", "xoinc"},
921     {"CameraOwnerName", "joseph", "joseph"},
922     {"CompositeImage", "3", "3"},
923     {"CompressedBitsPerPixel", "25", "25"},
924     {"DNGVersion", "2 2 3 2", "2, 2, 3, 2"},
925     {"DefaultCropSize", "123 654", "123, 654"},
926     {"Gamma", "3/2", "1.5"},
927     {"ISOSpeedLatitudeyyy", "123", "123"},
928     {"ISOSpeedLatitudezzz", "123", "123"},
929     {"LensMake", "plex", "plex"},
930     {"LensModel", "world", "world"},
931     {"LensSerialNumber", "root", "root"},
932     {"LensSpecification", "3/4 5/2 3/2 5/2", "0.8, 2.5, 1.5, 2.5"},
933     {"NewSubfileType", "5", "5"},
934     {"OffsetTime", "2023:01:25", "2023:01:25"},
935     {"OffsetTimeDigitized", "cirtize", "cirtize"},
936     {"OffsetTimeOriginal", "ject", "ject"},
937     {"SourceExposureTimesOfCompositeImage", "xixe", "xixe"},
938     {"SourceImageNumberOfCompositeImage", "11 23", "11, 23"},
939     {"SubfileType", "3", "3"},
940     {"GPSHPositioningError", "1/2", "0.5"},
941     {"PhotographicSensitivity", "65535", "65535"},
942     {"BitsPerSample", "1,1,1", "1, 1, 1"},
943     {"Orientation", "1", "Top-left"},
944     {"ImageLength", "0", "0"},
945     {"ImageWidth", "0", "0"},
946     {"GPSLatitude", "39,54,20", "39, 54, 20"},
947     {"GPSLongitude", "120/1 52/1 26/1", "120, 52, 26"},
948     {"GPSLatitudeRef", "N", "N"},
949     {"GPSLongitudeRef", "E", "E"},
950     {"DateTimeOriginal", "2024:01:25 05:51:34", "2024:01:25 05:51:34"},
951     {"ExposureTime", "1/34", "1/34 sec."},
952     {"SceneType", "1", "Directly photographed"},
953     {"ISOSpeedRatings", "1", "1"},
954     {"FNumber", "1/1", "f/1.0"},
955     {"DateTime", "2024:01:23", "2024:01:23"},
956     {"GPSTimeStamp", "11/1 37/1 58/1", "11:37:58.00"},
957     {"GPSDateStamp", "2025:01:11", "2025:01:11"},
958     {"ImageDescription", "_cuva%s\\d", "_cuva%s\\d"},
959     {"Make", "name", "name"},
960     {"Model", "TNY-AL00", "TNY-AL00"},
961     {"PhotoMode", "252", "252"},
962     {"JPEGProc", "252", "252"},
963     {"SensitivityType", "5", "Standard output sensitivity (SOS) and ISO speed"},
964     {"StandardOutputSensitivity", "5", "5"},
965     {"RecommendedExposureIndex", "123", "123"},
966     {"ISOSpeedRatings", "745", "745"},
967     {"ISOSpeed", "800", "800"},
968     {"ApertureValue", "4/1", "4.00 EV (f/4.0)"},
969     {"ExposureBiasValue", "23/1", "23.00 EV"},
970     {"MeteringMode", "5", "Pattern"},
971     {"LightSource", "1", "Daylight"},
972     {"Flash", "5", "Strobe return light not detected"},
973     {"FocalLength", "0/1", "0.0 mm"},
974     {"UserComment", "place for user comments", "place for user comments"},
975     {"PixelXDimension", "123", "123"},
976     {"PixelYDimension", "234", "234"},
977     {"WhiteBalance", "1", "Manual white balance"},
978     {"FocalLengthIn35mmFilm", "2", "2"},
979     {"Compression", "1", "Uncompressed"},
980     {"PhotometricInterpretation", "0", "Reversed mono"},
981     {"StripOffsets", "123", "123"},
982     {"SamplesPerPixel", "0", "0"},
983     {"RowsPerStrip", "123", "123"},
984     {"StripByteCounts", "123", "123"},
985     {"XResolution", "0/1", " 0"},
986     {"YResolution", "0/1", " 0"},
987     {"PlanarConfiguration", "1", "Chunky format"},
988     {"ResolutionUnit", "2", "Inch"},
989     {"TransferFunction", "abc", "3 bytes undefined data"},
990     {"Software", "abcdef", "abcdef"},
991     {"Artist", "None", "None"},
992     {"WhitePoint", "252/1", "252, 0/0"},
993     {"PrimaryChromaticities", "0/1", " 0"},
994     {"YCbCrCoefficients", "299/1000 587/1000 114/1000", "0.299, 0.587, 0.114"},
995     {"YCbCrSubSampling", "3 2", "3, 2"},
996     {"YCbCrPositioning", "1", "Centered"},
997     {"ReferenceBlackWhite", "222 0 1.5 0 25.2 25.2", "222,  0, 1.5,  0, 25.2, 25.2"},
998     {"Copyright", "undefined", "undefined (Photographer) - [None] (Editor)"},
999     {"ExposureProgram", "0", "Not defined"},
1000     {"SpectralSensitivity", "abc", "abc"},
1001     {"OECF", "excc", "4 bytes undefined data"},
1002     {"ExifVersion", "0110", "Exif Version 1.1"},
1003     {"DateTimeDigitized", "2022:06:02 15:51:34", "2022:06:02 15:51:34"},
1004     {"ComponentsConfiguration", "1456", "Y R G B"},
1005     {"ShutterSpeedValue", "5/2", "2.50 EV (1/6 sec.)"},
1006     {"BrightnessValue", "5/2", "2.50 EV (19.38 cd/m^2)"},
1007     {"MaxApertureValue", "5/2", "2.50 EV (f/2.4)"},
1008     {"SubjectDistance", "5/2", "2.5 m"},
1009     {"SubjectArea", "12 13", "(x,y) = (12,13)"},
1010     {"SubsecTime", "123456", "123456"},
1011     {"SubsecTimeOriginal", "427000", "427000"},
1012     {"SubsecTimeDigitized", "427000", "427000"},
1013     {"FlashpixVersion", "0100", "FlashPix Version 1.0"},
1014     {"ColorSpace", "1", "sRGB"},
1015     {"RelatedSoundFile", "/usr/home", "/usr/home"},
1016     {"FlashEnergy", "832/1", "832"},
1017     {"SpatialFrequencyResponse", "13", "13"},
1018     {"FocalPlaneXResolution", "1080/1", "1080"},
1019     {"FocalPlaneYResolution", "880/1", "880"},
1020     {"FocalPlaneResolutionUnit", "2", "Inch"},
1021     {"SubjectLocation", "0 1", "0, 1"},
1022     {"ExposureIndex", "3/2", "1.5"},
1023     {"SensingMethod", "3", "Two-chip color area sensor"},
1024     {"FileSource", "3", "DSC"},
1025     {"CFAPattern", "3", "1 bytes undefined data"},
1026     {"CustomRendered", "0", "Normal process"},
1027     {"ExposureMode", "0", "Auto exposure"},
1028     {"DigitalZoomRatio", "321/1", "321"},
1029     {"SceneCaptureType", "0", "Standard"},
1030     {"GainControl", "0", "Normal"},
1031     {"Contrast", "0", "Normal"},
1032     {"Saturation", "0", "Normal"},
1033     {"Sharpness", "0", "Normal"},
1034     {"DeviceSettingDescription", "2xxx", "2xxx"},
1035     {"SubjectDistanceRange", "0", "Unknown"},
1036     {"ImageUniqueID", "FXIC012", "FXIC012"},
1037     {"GPSVersionID", "2.2.0.0", "2.2.0.0"},
1038     {"GPSAltitudeRef", "0", "Sea level"},
1039     {"GPSAltitude", "0/100", "0.00"},
1040     {"GPSSatellites", "xxx", "xxx"},
1041     {"GPSStatus", "A", "A"},
1042     {"GPSMeasureMode", "2", "2"},
1043     {"GPSDOP", "182/1", "182"},
1044     {"GPSSpeedRef", "N", "N"},
1045     {"GPSSpeed", "150/1", "150"},
1046     {"GPSTrackRef", "T", "T"},
1047     {"GPSTrack", "114/3", "38.0"},
1048     {"GPSImgDirectionRef", "M", "M"},
1049     {"GPSImgDirection", "125/56", "2.23"},
1050     {"GPSMapDatum", "xxx", "xxx"},
1051     {"GPSDestLatitudeRef", "N", "N"},
1052     {"GPSDestLatitude", "33/1 22/1 11/1", "33, 22, 11"},
1053     {"GPSDestLongitudeRef", "E", "E"},
1054     {"GPSDestLongitude", "33/1 22/1 11/1", "33, 22, 11"},
1055     {"GPSDestBearingRef", "T", "T"},
1056     {"GPSDestBearing", "22/11", "2.0"},
1057     {"GPSDestDistanceRef", "N", "N"},
1058     {"GPSDestDistance", "10/1", "10"},
1059     {"GPSProcessingMethod", "CELLID", "CELLID"},
1060     {"GPSAreaInformation", "arexxx", "arexxx"},
1061     {"GPSDifferential", "0", "0"},
1062     {"BodySerialNumber", "exoch", "exoch"},
1063     {"CameraOwnerName", "c.uec", "c.uec"},
1064     {"CompositeImage", "2", "2"},
1065     {"CompressedBitsPerPixel", "24/1", "24"},
1066     {"DNGVersion", "2 2 3 1", "2, 2, 3, 1"},
1067     {"DefaultCropSize", "153 841", "153, 841"},
1068     {"Gamma", "5/2", "2.5"},
1069     {"ISOSpeedLatitudeyyy", "1456", "1456"},
1070     {"ISOSpeedLatitudezzz", "1456", "1456"},
1071     {"LensMake", "xxwx", "xxwx"},
1072     {"LensModel", "txaw", "txaw"},
1073     {"LensSerialNumber", "qxhc", "qxhc"},
1074     {"LensSpecification", "3/4 5/2 3/2 1/2", "0.8, 2.5, 1.5, 0.5"},
1075     {"NewSubfileType", "3", "3"},
1076     {"OffsetTime", "2024:01:25", "2024:01:25"},
1077     {"OffsetTimeDigitized", "cfh", "cfh"},
1078     {"OffsetTimeOriginal", "chex", "chex"},
1079     {"SourceExposureTimesOfCompositeImage", "xxxw", "xxxw"},
1080     {"SourceImageNumberOfCompositeImage", "23 34", "23, 34"},
1081     {"SubfileType", "2", "2"},
1082     {"GPSHPositioningError", "5/2", "2.5"},
1083     {"PhotographicSensitivity", "1", "1"},
1084     {"HwMnoteCaptureMode", "121", "121"},
1085     {"MovingPhotoId", "110", "110"},
1086     {"MovingPhotoVersion", "1", "1"},
1087     {"MicroVideoPresentationTimestampUS", "123232", "123232"},
1088     {"HwMnoteAiEdit", "1", "1"},
1089 };
1090 
1091 HWTEST_F(ExifMetadataTest, SetValueBatch006, TestSize.Level3)
1092 {
1093     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_BLANKEXIF_PATH.c_str());
1094     ASSERT_NE(exifData, nullptr);
1095 
1096     std::string value;
1097     ExifMetadata metadata(exifData);
1098 
1099     int rows = sizeof(g_batchData006) / sizeof(g_batchData006[0]);
1100     for (int i = 0; i < rows; ++i) {
1101         printf("set tag: %s\n", g_batchData006[i][0].c_str());
1102         std::string key = g_batchData006[i][0];
1103         std::string modifyvalue = g_batchData006[i][1];
1104         auto iv = ExifMetadatFormatter::Validate(key, modifyvalue);
1105         bool isValidateSuccess = (iv == Media::SUCCESS);
1106         ASSERT_TRUE(isValidateSuccess);
1107 
1108         auto isSetValueSuccess = metadata.SetValue(key, modifyvalue);
1109         ASSERT_TRUE(isSetValueSuccess);
1110 
1111         std::string retvalue;
1112         metadata.GetValue(key, retvalue);
1113         ASSERT_EQ(retvalue, g_batchData006[i][2]);
1114     }
1115 }
1116 
1117 std::string g_error[][2] = {
1118     {"BitsPerSample", "8,8"},
1119     {"Orientation", "0"},
1120     {"ImageLength", "abc"},
1121     {"ImageWidth", "@@@"},
1122     {"GPSLatitude", "abc,3"},
1123     {"GPSLongitude", "12,a"},
1124     {"GPSLatitudeRef", "W"},
1125     {"GPSLongitudeRef", "S"},
1126     {"DateTimeOriginal", "05:61:34"},
1127     {"ExposureTime", "1/0"},
1128     {"SceneType", "abc"},
1129     {"ISOSpeedRatings", "-1"},
1130     {"FNumber", "1/0"},
1131     {"DateTime", "2024:13"},
1132     {"GPSTimeStamp", "37/0,58/0"},
1133     {"GPSDateStamp", "2023:01"},
1134     {"SensitivityType", "a"},
1135     {"StandardOutputSensitivity", "abc"},
1136     {"RecommendedExposureIndex", "-123"},
1137     {"ISOSpeed", "a"},
1138     {"ApertureValue", "a"},
1139     {"ExposureBiasValue", "a"},
1140     {"MeteringMode", "256"},
1141     {"LightSource", "256"},
1142     {"Flash", "999"},
1143     {"FocalLength", "a"},
1144     {"UserComment", ""},
1145     {"PixelXDimension", "abc"},
1146     {"PixelYDimension", "!!!"},
1147     {"WhiteBalance", "2"},
1148     {"FocalLengthIn35mmFilm", "abc"},
1149     {"Compression", "11"},
1150     {"PhotometricInterpretation", "a"},
1151     {"StripOffsets", "abc"},
1152     {"SamplesPerPixel", "-1"},
1153     {"RowsPerStrip", "abc"},
1154     {"StripByteCounts", "abc"},
1155     {"XResolution", "a"},
1156     {"YResolution", "b"},
1157     {"PlanarConfiguration", "a"},
1158     {"ResolutionUnit", "4"},
1159     {"WhitePoint", "abc"},
1160     {"PrimaryChromaticities", "abc"},
1161     {"YCbCrCoefficients", "123,345"},
1162     {"YCbCrSubSampling", "4"},
1163     {"YCbCrPositioning", "3"},
1164     {"ReferenceBlackWhite", "undefined"},
1165     {"ExposureProgram", "-1"},
1166     {"ExifVersion", "a"},
1167     {"DateTimeDigitized", "a"},
1168     {"ComponentsConfiguration", "a"},
1169     {"ShutterSpeedValue", "0/0"},
1170     {"BrightnessValue", "12000000/0"},
1171     {"MaxApertureValue", "-1/0"},
1172     {"SubjectDistance", "meter"},
1173     {"SubjectArea", "abc"},
1174     {"FlashpixVersion", "abc"},
1175     {"ColorSpace", "abc"},
1176     {"FlashEnergy", "abc"},
1177     {"SpatialFrequencyResponse", ""},
1178     {"FocalPlaneXResolution", "abc"},
1179     {"FocalPlaneYResolution", "abc"},
1180     {"FocalPlaneResolutionUnit", "255"},
1181     {"SubjectLocation", "2"},
1182     {"ExposureIndex", "-1/1"},
1183     {"SensingMethod", "9"},
1184     {"CustomRendered", "2"},
1185     {"ExposureMode", "3"},
1186     {"DigitalZoomRatio", "a"},
1187     {"SceneCaptureType", "4"},
1188     {"GainControl", "5"},
1189     {"Contrast", "3"},
1190     {"Saturation", "65536"},
1191     {"Sharpness", "65535"},
1192     {"DeviceSettingDescription", ""},
1193     {"SubjectDistanceRange", "a"},
1194     {"GPSVersionID", "23"},
1195     {"GPSAltitudeRef", "2"},
1196     {"GPSAltitude", "abc"},
1197     {"GPSStatus", "C"},
1198     {"GPSMeasureMode", "4"},
1199     {"GPSDOP", "-1"},
1200     {"GPSSpeedRef", "AA"},
1201     {"GPSSpeed", "a"},
1202     {"GPSTrack", "a"},
1203     {"GPSImgDirectionRef", "C"},
1204     {"GPSImgDirection", "a"},
1205     {"GPSDestLatitudeRef", "W"},
1206     {"GPSDestLatitude", "abc"},
1207     {"GPSDestLongitudeRef", "S"},
1208     {"GPSDestLongitude", "none"},
1209     {"GPSDestBearing", "x"},
1210     {"GPSDestDistanceRef", "C"},
1211     {"GPSDestDistance", "B"},
1212     {"GPSDifferential", "4"},
1213     {"CompositeImage", "5"},
1214     {"CompressedBitsPerPixel", "diry"},
1215     {"DNGVersion", "2 3"},
1216     {"DefaultCropSize", "hi xic"},
1217     {"Gamma", "rat"},
1218     {"ISOSpeedLatitudeyyy", "a"},
1219     {"ISOSpeedLatitudezzz", "bc"},
1220     {"LensSpecification", "a b c"},
1221     {"NewSubfileType", "a"},
1222     {"SourceImageNumberOfCompositeImage", "a"},
1223     {"SubfileType", "5"},
1224     {"GPSHPositioningError", "a"},
1225     {"PhotographicSensitivity", "-1"},
1226     {"GPSLatitude", "100,20,10"},
1227     {"GPSLongitude", "200,20,10"},
1228     {"DateTime", "2024:01:23 25:10:10"},
1229     {"ImageLength", "65538"},
1230 };
1231 
1232 
1233 HWTEST_F(ExifMetadataTest, SetValueBatch007, TestSize.Level3)
1234 {
1235     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_BLANKEXIF_PATH.c_str());
1236     ASSERT_NE(exifData, nullptr);
1237 
1238     std::string value;
1239     ExifMetadata metadata(exifData);
1240 
1241     int rows = sizeof(g_error) / sizeof(g_error[0]);
1242     for (int i = 0; i < rows; ++i) {
1243         std::string key = g_error[i][0];
1244         std::string modifyvalue = g_error[i][1];
1245         auto iv = ExifMetadatFormatter::Validate(key, modifyvalue);
1246         bool isValidateSuccess = (iv == Media::SUCCESS);
1247         auto isSetValueSuccess = metadata.SetValue(key, modifyvalue);
1248         ASSERT_FALSE(isValidateSuccess && isSetValueSuccess);
1249     }
1250 }
1251 
1252 std::string g_batchData008[][3] = {
1253     {"BitsPerSample", "65535,65535,65535", "65535, 65535, 65535"},
1254     {"Orientation", "8", "Left-bottom"},
1255     {"ImageLength", "65535", "65535"},
1256     {"ImageWidth", "65535", "65535"},
1257     {"GPSLatitude", "5,2", "2.5,  0,  0"},
1258     {"GPSLongitude", "10,4", "2.5,  0,  0"},
1259     {"GPSLatitudeRef", "S", "S"},
1260     {"GPSLongitudeRef", "W", "W"},
1261     {"DateTimeOriginal", "1900:01:01 00:00:00", "1900:01:01 00:00:00"},
1262     {"ExposureTime", "1/60", "1/60 sec."},
1263     {"ISOSpeedRatings", "65535", "65535"},
1264     {"FNumber", "1/30", "f/0.0"},
1265     {"DateTime", "1900:01:01", "1900:01:01"},
1266     {"GPSTimeStamp", "12 54 20", "12:54:20.00"},
1267     {"GPSDateStamp", "1900:01:01", "1900:01:01"},
1268     {"ImageDescription", "@  @", "@  @"},
1269     {"Make", "APPLE", "APPLE"},
1270     {"Model", "%s \\0", "%s \\0"},
1271     {"PhotoMode", "13", "13"},
1272     {"JPEGProc", "13", "13"},
1273     {"SensitivityType", "0", "Unknown"},
1274     {"StandardOutputSensitivity", "1000", "1000"},
1275     {"RecommendedExposureIndex", "2147483647", "2147483647"},
1276     {"ISOSpeedRatings", "65535", "65535"},
1277     {"ISOSpeed", "65535", "65535"},
1278     {"ApertureValue", "16", "16.00 EV (f/256.0)"},
1279     {"ExposureBiasValue", "4", "4.00 EV"},
1280     {"MeteringMode", "0", "Unknown"},
1281     {"LightSource", "2", "Fluorescent"},
1282     {"Flash", "95", "Flash fired, auto mode, return light detected, red-eye reduction mode"},
1283     {"FocalLength", "31/1", "31.0 mm"},
1284     {"UserComment", "%s \\0", "%s \\0"},
1285     {"PixelXDimension", "0", "0"},
1286     {"PixelYDimension", "0", "0"},
1287     {"WhiteBalance", "0", "Auto white balance"},
1288     {"FocalLengthIn35mmFilm", "12", "12"},
1289     {"Compression", "32773", "PackBits compression"},
1290     {"PhotometricInterpretation", "1", "Normal mono"},
1291     {"StripOffsets", "456", "456"},
1292     {"SamplesPerPixel", "65535", "65535"},
1293     {"RowsPerStrip", "345", "345"},
1294     {"StripByteCounts", "345", "345"},
1295     {"XResolution", "31/1", "31"},
1296     {"YResolution", "31/1", "31"},
1297     {"PlanarConfiguration", "2", "Planar format"},
1298     {"ResolutionUnit", "3", "Centimeter"},
1299     {"Software", "%s \\0", "%s \\0"},
1300     {"Artist", "%s \\0", "%s \\0"},
1301     {"WhitePoint", "31", "31, 0/0"},
1302     {"WhitePoint", "31/1", "31, 0/0"},
1303     {"WhitePoint", "31/1, 5/2", "31, 2.5"},
1304     {"PrimaryChromaticities", "31/1", "31"},
1305     {"YCbCrCoefficients", "3/2 5/2 5/2", "1.5, 2.5, 2.5"},
1306     {"YCbCrSubSampling", "4 5", "4, 5"},
1307     {"YCbCrPositioning", "2", "Co-sited"},
1308     {"ReferenceBlackWhite", "3", " 3, 255,  0, 255,  0, 255"},
1309     {"Copyright", "joseph", "joseph (Photographer) - [None] (Editor)"},
1310     {"ExposureProgram", "8", "Landscape mode (for landscape photos with the background in focus)"},
1311     {"SpectralSensitivity", "1234", "1234"},
1312     {"ExifVersion", "0120", "Exif Version 1.2"},
1313     {"ExifVersion", "1.1", "Exif Version 1.1"},
1314     {"DateTimeDigitized", "1900:01:01 00:00:00", "1900:01:01 00:00:00"},
1315     {"ComponentsConfiguration", "1256", "Y Cb G B"},
1316     {"ShutterSpeedValue", "3/2", "1.50 EV (1/3 sec.)"},
1317     {"BrightnessValue", "6/5", "1.20 EV (7.87 cd/m^2)"},
1318     {"MaxApertureValue", "8/5", "1.60 EV (f/1.7)"},
1319     {"SubjectDistance", "1/2", "0.5 m"},
1320     {"SubjectArea", "45 23", "(x,y) = (45,23)"},
1321     {"SubsecTime", "427000", "427000"},
1322     {"SubsecTimeOriginal", "123456", "123456"},
1323     {"SubsecTimeDigitized", "999999", "999999"},
1324     {"FlashpixVersion", "0101", "FlashPix Version 1.01"},
1325     {"ColorSpace", "2", "Adobe RGB"},
1326     {"RelatedSoundFile", "abc", "abc"},
1327     {"FlashEnergy", "5/2", "2.5"},
1328     {"SpatialFrequencyResponse", "corn", "corn"},
1329     {"FocalPlaneXResolution", "102/1", "102"},
1330     {"FocalPlaneYResolution", "81/1", "81"},
1331     {"FocalPlaneResolutionUnit", "3", "Centimeter"},
1332     {"SubjectLocation", "23 112", "23, 112"},
1333     {"ExposureIndex", "5/2", "2.5"},
1334     {"SensingMethod", "8", "Color sequential linear sensor"},
1335     {"CustomRendered", "1", "Custom process"},
1336     {"ExposureMode", "2", "Auto bracket"},
1337     {"DigitalZoomRatio", "23/1", "23"},
1338     {"SceneCaptureType", "3", "Night scene"},
1339     {"GainControl", "4", "High gain down"},
1340     {"Contrast", "2", "Hard"},
1341     {"Saturation", "2", "High saturation"},
1342     {"Sharpness", "2", "Hard"},
1343     {"DeviceSettingDescription", "coxex", "coxex"},
1344     {"SubjectDistanceRange", "3", "Distant view"},
1345     {"ImageUniqueID", "xxx", "xxx"},
1346     {"GPSVersionID", "2.2.0.1", "2.2.0.1"},
1347     {"GPSAltitudeRef", "1", "Sea level reference"},
1348     {"GPSSatellites", "a b c", "a b c"},
1349     {"GPSStatus", "V", "V"},
1350     {"GPSMeasureMode", "3", "3"},
1351     {"GPSDOP", "3/2", "1.5"},
1352     {"GPSSpeedRef", "K", "K"},
1353     {"GPSSpeed", "1/2", "0.5"},
1354     {"GPSTrackRef", "M", "M"},
1355     {"GPSTrack", "3.5", "3.5"},
1356     {"GPSImgDirectionRef", "T", "T"},
1357     {"GPSImgDirection", "2.5", "2.5"},
1358     {"GPSMapDatum", "%s\\0", "%s\\0"},
1359     {"GPSDestLatitudeRef", "S", "S"},
1360     {"GPSDestLatitude", "0/1 0/1 0/1", " 0,  0,  0"},
1361     {"GPSDestLongitudeRef", "W", "W"},
1362     {"GPSDestLongitude", "0/1 0/1 0/1", " 0,  0,  0"},
1363     {"GPSDestBearingRef", "M", "M"},
1364     {"GPSDestBearing", "2.5", "2.5"},
1365     {"GPSDestDistanceRef", "K", "K"},
1366     {"GPSDestDistance", "2.5", "2.5"},
1367     {"GPSProcessingMethod", "XXX", "XXX"},
1368     {"GPSAreaInformation", "client", "client"},
1369     {"GPSDifferential", "1", "1"},
1370     {"BodySerialNumber", "xoinc", "xoinc"},
1371     {"CameraOwnerName", "joseph", "joseph"},
1372     {"CompositeImage", "3", "3"},
1373     {"CompressedBitsPerPixel", "25", "25"},
1374     {"DNGVersion", "2 2 3 2", "2, 2, 3, 2"},
1375     {"DefaultCropSize", "123 654", "123, 654"},
1376     {"Gamma", "3/2", "1.5"},
1377     {"ISOSpeedLatitudeyyy", "123", "123"},
1378     {"ISOSpeedLatitudezzz", "123", "123"},
1379     {"LensMake", "plex", "plex"},
1380     {"LensModel", "world", "world"},
1381     {"LensSerialNumber", "root", "root"},
1382     {"LensSpecification", "3/4 5/2 3/2 5/2", "0.8, 2.5, 1.5, 2.5"},
1383     {"NewSubfileType", "5", "5"},
1384     {"OffsetTime", "2023:01:25", "2023:01:25"},
1385     {"OffsetTimeDigitized", "cirtize", "cirtize"},
1386     {"OffsetTimeOriginal", "ject", "ject"},
1387     {"SourceExposureTimesOfCompositeImage", "xixe", "xixe"},
1388     {"SourceImageNumberOfCompositeImage", "11 23", "11, 23"},
1389     {"SubfileType", "3", "3"},
1390     {"GPSHPositioningError", "1/2", "0.5"},
1391     {"PhotographicSensitivity", "65535", "65535"},
1392     {"BitsPerSample", "1,1,1", "1, 1, 1"},
1393     {"Orientation", "1", "Top-left"},
1394     {"ImageLength", "0", "0"},
1395     {"ImageWidth", "0", "0"},
1396     {"GPSLatitude", "39,54,20", "39, 54, 20"},
1397     {"GPSLongitude", "120/1 52/1 26/1", "120, 52, 26"},
1398     {"GPSLatitudeRef", "N", "N"},
1399     {"GPSLongitudeRef", "E", "E"},
1400     {"DateTimeOriginal", "2024:01:25 05:51:34", "2024:01:25 05:51:34"},
1401     {"ExposureTime", "1/34", "1/34 sec."},
1402     {"ExposureTime", "3/5", "0.6 sec."},
1403     {"ExposureTime", "1/10", "1/10 sec."},
1404     {"ExposureTime", "10/100", "1/10 sec."},
1405     {"ExposureTime", "2/10", "1/5 sec."},
1406     {"ExposureTime", "5/10", "0.5 sec."},
1407     {"ExposureTime", "16/10", "1.6 sec."},
1408     {"ExposureTime", "12/2", "6 sec."},
1409     {"ExposureTime", "1696000/1000000000", "1/590 sec."},
1410     {"ExposureTime", "4000000000/1000000000", "4 sec."},
1411     {"SceneType", "1", "Directly photographed"},
1412     {"ISOSpeedRatings", "1", "1"},
1413     {"FNumber", "1/1", "f/1.0"},
1414     {"DateTime", "2024:01:23", "2024:01:23"},
1415     {"GPSTimeStamp", "11/1 37/1 58/1", "11:37:58.00"},
1416     {"GPSDateStamp", "2025:01:11", "2025:01:11"},
1417     {"ImageDescription", "_cuva%s\\d", "_cuva%s\\d"},
1418     {"Make", "name", "name"},
1419     {"Model", "TNY-AL00", "TNY-AL00"},
1420     {"PhotoMode", "252", "252"},
1421     {"JPEGProc", "252", "252"},
1422     {"SensitivityType", "5", "Standard output sensitivity (SOS) and ISO speed"},
1423     {"StandardOutputSensitivity", "5", "5"},
1424     {"RecommendedExposureIndex", "123", "123"},
1425     {"ISOSpeedRatings", "745", "745"},
1426     {"ISOSpeed", "800", "800"},
1427     {"ApertureValue", "4/1", "4.00 EV (f/4.0)"},
1428     {"ExposureBiasValue", "23/1", "23.00 EV"},
1429     {"MeteringMode", "5", "Pattern"},
1430     {"LightSource", "1", "Daylight"},
1431     {"Flash", "5", "Strobe return light not detected"},
1432     {"FocalLength", "0/1", "0.0 mm"},
1433     {"UserComment", "place for user comments", "place for user comments"},
1434     {"PixelXDimension", "123", "123"},
1435     {"PixelYDimension", "234", "234"},
1436     {"WhiteBalance", "1", "Manual white balance"},
1437     {"FocalLengthIn35mmFilm", "2", "2"},
1438     {"Compression", "1", "Uncompressed"},
1439     {"PhotometricInterpretation", "0", "Reversed mono"},
1440     {"StripOffsets", "123", "123"},
1441     {"SamplesPerPixel", "0", "0"},
1442     {"RowsPerStrip", "123", "123"},
1443     {"StripByteCounts", "123", "123"},
1444     {"XResolution", "0/1", " 0"},
1445     {"YResolution", "0/1", " 0"},
1446     {"PlanarConfiguration", "1", "Chunky format"},
1447     {"ResolutionUnit", "2", "Inch"},
1448     {"Software", "abcdef", "abcdef"},
1449     {"Artist", "None", "None"},
1450     {"PrimaryChromaticities", "0/1", " 0"},
1451     {"YCbCrCoefficients", "299/1000 587/1000 114/1000", "0.299, 0.587, 0.114"},
1452     {"YCbCrSubSampling", "3 2", "3, 2"},
1453     {"YCbCrPositioning", "1", "Centered"},
1454     {"ReferenceBlackWhite", "222 0 1.5 0 25.2 25.2", "222,  0, 1.5,  0, 25.2, 25.2"},
1455     {"Copyright", "undefined", "undefined (Photographer) - [None] (Editor)"},
1456     {"Copyright", "213(%&-xd", "213(%&-xd (Photographer) - [None] (Editor)"},
1457     {"ExposureProgram", "0", "Not defined"},
1458     {"SpectralSensitivity", "abc", "abc"},
1459     {"ExifVersion", "0110", "Exif Version 1.1"},
1460     {"DateTimeDigitized", "2022:06:02 15:51:34", "2022:06:02 15:51:34"},
1461     {"ComponentsConfiguration", "1456", "Y R G B"},
1462     {"ShutterSpeedValue", "5/2", "2.50 EV (1/6 sec.)"},
1463     {"BrightnessValue", "5/2", "2.50 EV (19.38 cd/m^2)"},
1464     {"MaxApertureValue", "5/2", "2.50 EV (f/2.4)"},
1465     {"SubjectDistance", "5/2", "2.5 m"},
1466     {"SubjectArea", "12 13", "(x,y) = (12,13)"},
1467     {"SubsecTime", "123456", "123456"},
1468     {"SubsecTimeOriginal", "427000", "427000"},
1469     {"SubsecTimeDigitized", "427000", "427000"},
1470     {"FlashpixVersion", "0100", "FlashPix Version 1.0"},
1471     {"ColorSpace", "1", "sRGB"},
1472     {"RelatedSoundFile", "/usr/home", "/usr/home"},
1473     {"FlashEnergy", "832/1", "832"},
1474     {"SpatialFrequencyResponse", "13", "13"},
1475     {"FocalPlaneXResolution", "1080/1", "1080"},
1476     {"FocalPlaneYResolution", "880/1", "880"},
1477     {"FocalPlaneResolutionUnit", "2", "Inch"},
1478     {"SubjectLocation", "0 1", "0, 1"},
1479     {"ExposureIndex", "3/2", "1.5"},
1480     {"SensingMethod", "3", "Two-chip color area sensor"},
1481     {"FileSource", "3", "DSC"},
1482     {"CustomRendered", "0", "Normal process"},
1483     {"ExposureMode", "0", "Auto exposure"},
1484     {"DigitalZoomRatio", "321/1", "321"},
1485     {"SceneCaptureType", "0", "Standard"},
1486     {"GainControl", "0", "Normal"},
1487     {"Contrast", "0", "Normal"},
1488     {"Saturation", "0", "Normal"},
1489     {"Sharpness", "0", "Normal"},
1490     {"DeviceSettingDescription", "2xxx", "2xxx"},
1491     {"SubjectDistanceRange", "0", "Unknown"},
1492     {"ImageUniqueID", "FXIC012", "FXIC012"},
1493     {"GPSVersionID", "2.2.0.0", "2.2.0.0"},
1494     {"GPSAltitudeRef", "0", "Sea level"},
1495     {"GPSAltitude", "5/2", "2.5"},
1496     {"GPSSatellites", "xxx", "xxx"},
1497     {"GPSStatus", "A", "A"},
1498     {"GPSMeasureMode", "2", "2"},
1499     {"GPSDOP", "182/1", "182"},
1500     {"GPSSpeedRef", "N", "N"},
1501     {"GPSSpeed", "150/1", "150"},
1502     {"GPSTrackRef", "T", "T"},
1503     {"GPSTrack", "5/2", "2.5"},
1504     {"GPSImgDirectionRef", "M", "M"},
1505     {"GPSImgDirection", "125/56", "2.23"},
1506     {"GPSMapDatum", "xxx", "xxx"},
1507     {"GPSDestLatitudeRef", "N", "N"},
1508     {"GPSDestLatitude", "33/1 22/1 11/1", "33, 22, 11"},
1509     {"GPSDestLongitudeRef", "E", "E"},
1510     {"GPSDestLongitude", "33/1 22/1 11/1", "33, 22, 11"},
1511     {"GPSDestBearingRef", "T", "T"},
1512     {"GPSDestBearing", "5/2", "2.5"},
1513     {"GPSDestDistanceRef", "N", "N"},
1514     {"GPSDestDistance", "10/1", "10"},
1515     {"GPSProcessingMethod", "CELLID", "CELLID"},
1516     {"GPSAreaInformation", "arexxx", "arexxx"},
1517     {"GPSDifferential", "0", "0"},
1518     {"BodySerialNumber", "exoch", "exoch"},
1519     {"CameraOwnerName", "c.uec", "c.uec"},
1520     {"CompositeImage", "2", "2"},
1521     {"CompressedBitsPerPixel", "24/1", "24"},
1522     {"DNGVersion", "2 2 3 1", "2, 2, 3, 1"},
1523     {"DefaultCropSize", "153 841", "153, 841"},
1524     {"Gamma", "5/2", "2.5"},
1525     {"ISOSpeedLatitudeyyy", "1456", "1456"},
1526     {"ISOSpeedLatitudezzz", "1456", "1456"},
1527     {"LensMake", "xxwx", "xxwx"},
1528     {"LensModel", "txaw", "txaw"},
1529     {"LensSerialNumber", "qxhc", "qxhc"},
1530     {"LensSpecification", "3/4 5/2 3/2 1/2", "0.8, 2.5, 1.5, 0.5"},
1531     {"NewSubfileType", "3", "3"},
1532     {"OffsetTime", "2024:01:25", "2024:01:25"},
1533     {"OffsetTimeDigitized", "cfh", "cfh"},
1534     {"OffsetTimeOriginal", "chex", "chex"},
1535     {"SourceExposureTimesOfCompositeImage", "xxxw", "xxxw"},
1536     {"SourceImageNumberOfCompositeImage", "23 34", "23, 34"},
1537     {"SubfileType", "2", "2"},
1538     {"GPSHPositioningError", "5/2", "2.5"},
1539     {"PhotographicSensitivity", "1", "1"},
1540 };
1541 
1542 HWTEST_F(ExifMetadataTest, SetValueBatch008, TestSize.Level3)
1543 {
1544     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_BLANKEXIF_PATH.c_str());
1545     ASSERT_NE(exifData, nullptr);
1546 
1547     std::string value;
1548     ExifMetadata metadata(exifData);
1549 
1550     int rows = sizeof(g_batchData008) / sizeof(g_batchData008[0]);
1551     for (int i = 0; i < rows; i++) {
1552         printf("set tag: %s\n", g_batchData008[i][0].c_str());
1553         std::string key = g_batchData008[i][0];
1554         std::string modifyvalue = g_batchData008[i][1];
1555         auto iv = ExifMetadatFormatter::Validate(key, modifyvalue);
1556         bool isValidateSuccess = (iv == Media::SUCCESS);
1557         ASSERT_TRUE(isValidateSuccess);
1558 
1559         auto isSetValueSuccess = metadata.SetValue(key, modifyvalue);
1560         ASSERT_TRUE(isSetValueSuccess);
1561 
1562         std::string retvalue;
1563         metadata.GetValue(key, retvalue);
1564         ASSERT_EQ(retvalue, g_batchData008[i][2]);
1565 
1566         auto isSetValueAgainSuccess = metadata.SetValue(key, retvalue);
1567         ASSERT_TRUE(isSetValueAgainSuccess);
1568 
1569         std::string retvalueAgain;
1570         metadata.GetValue(key, retvalueAgain);
1571         ASSERT_EQ(retvalueAgain, g_batchData008[i][2]);
1572     }
1573 }
1574 
1575 std::map<std::string, ExifIfd> IFDTable = {
1576     { "BitsPerSample", EXIF_IFD_0 },
1577     { "Orientation", EXIF_IFD_0 },
1578     { "ImageLength", EXIF_IFD_0 },
1579     { "ImageWidth", EXIF_IFD_0 },
1580     { "Compression", EXIF_IFD_0 },
1581     { "StripOffsets", EXIF_IFD_0 },
1582     { "PhotoMode", EXIF_IFD_0},
1583     { "JPEGProc", EXIF_IFD_0},
1584     { "PhotometricInterpretation", EXIF_IFD_0},
1585     { "SamplesPerPixel", EXIF_IFD_0},
1586     { "RowsPerStrip", EXIF_IFD_0},
1587     { "StripByteCounts", EXIF_IFD_0},
1588     { "XResolution", EXIF_IFD_0},
1589     { "YResolution", EXIF_IFD_0},
1590     { "PlanarConfiguration", EXIF_IFD_0},
1591     { "ResolutionUnit", EXIF_IFD_0},
1592     { "TransferFunction", EXIF_IFD_0},
1593     { "Software", EXIF_IFD_0},
1594     { "Artist", EXIF_IFD_0},
1595     { "WhitePoint", EXIF_IFD_0},
1596     { "PrimaryChromaticities", EXIF_IFD_0},
1597     { "YCbCrCoefficients", EXIF_IFD_0},
1598     { "YCbCrSubSampling", EXIF_IFD_0},
1599     { "YCbCrPositioning", EXIF_IFD_0},
1600     { "ReferenceBlackWhite", EXIF_IFD_0},
1601     { "Copyright", EXIF_IFD_0},
1602     { "JPEGInterchangeFormat", EXIF_IFD_1},
1603     { "JPEGInterchangeFormatLength", EXIF_IFD_1},
1604     { "NewSubfileType", EXIF_IFD_0},
1605     { "DateTime", EXIF_IFD_0 },
1606     { "ImageDescription", EXIF_IFD_0 },
1607     { "Make", EXIF_IFD_0 },
1608     { "Model", EXIF_IFD_0 },
1609     { "DefaultCropSize", EXIF_IFD_0 },
1610     { "DNGVersion", EXIF_IFD_0 },
1611     { "SubfileType", EXIF_IFD_0 },
1612     { "DateTimeOriginal", EXIF_IFD_EXIF },
1613     { "ExposureTime", EXIF_IFD_EXIF },
1614     { "FNumber", EXIF_IFD_EXIF },
1615     { "ISOSpeedRatings", EXIF_IFD_EXIF },
1616     { "ISOSpeed", EXIF_IFD_EXIF},
1617     { "DeviceSettingDescription", EXIF_IFD_EXIF},
1618     { "SceneType", EXIF_IFD_EXIF },
1619     { "CompressedBitsPerPixel", EXIF_IFD_EXIF },
1620     { "SensitivityType", EXIF_IFD_EXIF },
1621     { "StandardOutputSensitivity", EXIF_IFD_EXIF },
1622     { "RecommendedExposureIndex", EXIF_IFD_EXIF },
1623     { "ApertureValue", EXIF_IFD_EXIF },
1624     { "ExposureBiasValue", EXIF_IFD_EXIF },
1625     { "MeteringMode", EXIF_IFD_EXIF },
1626     { "FocalLength", EXIF_IFD_EXIF },
1627     { "ExposureProgram", EXIF_IFD_EXIF },
1628     { "SpectralSensitivity", EXIF_IFD_EXIF },
1629     { "OECF", EXIF_IFD_EXIF },
1630     { "ExifVersion", EXIF_IFD_EXIF },
1631     { "DateTimeDigitized", EXIF_IFD_EXIF },
1632     { "ComponentsConfiguration", EXIF_IFD_EXIF },
1633     { "ShutterSpeedValue", EXIF_IFD_EXIF },
1634     { "BrightnessValue", EXIF_IFD_EXIF },
1635     { "MaxApertureValue", EXIF_IFD_EXIF },
1636     { "SubjectDistance", EXIF_IFD_EXIF },
1637     { "SubjectArea", EXIF_IFD_EXIF },
1638     { "MakerNote", EXIF_IFD_EXIF },
1639     { "SubsecTime", EXIF_IFD_EXIF },
1640     { "SubsecTimeOriginal", EXIF_IFD_EXIF },
1641     { "SubsecTimeDigitized", EXIF_IFD_EXIF },
1642     { "FlashpixVersion", EXIF_IFD_EXIF },
1643     { "ColorSpace", EXIF_IFD_EXIF },
1644     { "RelatedSoundFile", EXIF_IFD_EXIF },
1645     { "FlashEnergy", EXIF_IFD_EXIF },
1646     { "FocalPlaneXResolution", EXIF_IFD_EXIF },
1647     { "FocalPlaneYResolution", EXIF_IFD_EXIF },
1648     { "FocalPlaneResolutionUnit", EXIF_IFD_EXIF },
1649     { "SubjectLocation", EXIF_IFD_EXIF },
1650     { "ExposureIndex", EXIF_IFD_EXIF },
1651     { "SensingMethod", EXIF_IFD_EXIF },
1652     { "FileSource", EXIF_IFD_EXIF },
1653     { "CFAPattern", EXIF_IFD_EXIF },
1654     { "CustomRendered", EXIF_IFD_EXIF },
1655     { "ExposureMode", EXIF_IFD_EXIF },
1656     { "DigitalZoomRatio", EXIF_IFD_EXIF },
1657     { "SceneCaptureType", EXIF_IFD_EXIF },
1658     { "GainControl", EXIF_IFD_EXIF },
1659     { "Contrast", EXIF_IFD_EXIF },
1660     { "Saturation", EXIF_IFD_EXIF },
1661     { "Sharpness", EXIF_IFD_EXIF },
1662     { "SubjectDistanceRange", EXIF_IFD_EXIF },
1663     { "ImageUniqueID", EXIF_IFD_EXIF },
1664     { "BodySerialNumber", EXIF_IFD_EXIF },
1665     { "CameraOwnerName", EXIF_IFD_EXIF },
1666     { "CompositeImage", EXIF_IFD_EXIF },
1667     { "Gamma", EXIF_IFD_EXIF },
1668     { "ISOSpeedLatitudeyyy", EXIF_IFD_EXIF },
1669     { "ISOSpeedLatitudezzz", EXIF_IFD_EXIF },
1670     { "SpatialFrequencyResponse", EXIF_IFD_EXIF},
1671     { "LensMake", EXIF_IFD_EXIF },
1672     { "LensModel", EXIF_IFD_EXIF },
1673     { "LensSerialNumber", EXIF_IFD_EXIF },
1674     { "LensSpecification", EXIF_IFD_EXIF },
1675     { "OffsetTime", EXIF_IFD_EXIF },
1676     { "OffsetTimeDigitized", EXIF_IFD_EXIF },
1677     { "OffsetTimeOriginal", EXIF_IFD_EXIF },
1678     { "SourceExposureTimesOfCompositeImage", EXIF_IFD_EXIF },
1679     { "SourceImageNumberOfCompositeImage", EXIF_IFD_EXIF },
1680     { "LightSource", EXIF_IFD_EXIF },
1681     { "Flash", EXIF_IFD_EXIF },
1682     { "FocalLengthIn35mmFilm", EXIF_IFD_EXIF },
1683     { "UserComment", EXIF_IFD_EXIF },
1684     { "PixelXDimension", EXIF_IFD_EXIF },
1685     { "PixelYDimension", EXIF_IFD_EXIF },
1686     { "WhiteBalance", EXIF_IFD_EXIF },
1687     { "GPSVersionID", EXIF_IFD_GPS },
1688     { "GPSLatitudeRef", EXIF_IFD_GPS },
1689     { "GPSLatitude", EXIF_IFD_GPS },
1690     { "GPSLongitudeRef", EXIF_IFD_GPS },
1691     { "GPSLongitude", EXIF_IFD_GPS },
1692     { "GPSAltitudeRef", EXIF_IFD_GPS },
1693     { "GPSAltitude", EXIF_IFD_GPS },
1694     { "GPSTimeStamp", EXIF_IFD_GPS },
1695     { "GPSSatellites", EXIF_IFD_GPS },
1696     { "GPSStatus", EXIF_IFD_GPS },
1697     { "GPSMeasureMode", EXIF_IFD_GPS },
1698     { "GPSDOP", EXIF_IFD_GPS },
1699     { "GPSSpeedRef", EXIF_IFD_GPS },
1700     { "GPSSpeed", EXIF_IFD_GPS },
1701     { "GPSTrackRef", EXIF_IFD_GPS },
1702     { "GPSTrack", EXIF_IFD_GPS },
1703     { "GPSImgDirectionRef", EXIF_IFD_GPS },
1704     { "GPSImgDirection", EXIF_IFD_GPS },
1705     { "GPSMapDatum", EXIF_IFD_GPS },
1706     { "GPSDestLatitudeRef", EXIF_IFD_GPS },
1707     { "GPSDestLatitude", EXIF_IFD_GPS },
1708     { "GPSDestLongitudeRef", EXIF_IFD_GPS },
1709     { "GPSDestLongitude", EXIF_IFD_GPS },
1710     { "GPSDestBearingRef", EXIF_IFD_GPS },
1711     { "GPSDestBearing", EXIF_IFD_GPS },
1712     { "GPSDestDistanceRef", EXIF_IFD_GPS },
1713     { "GPSDestDistance", EXIF_IFD_GPS },
1714     { "GPSProcessingMethod", EXIF_IFD_GPS },
1715     { "GPSAreaInformation", EXIF_IFD_GPS },
1716     { "GPSDateStamp", EXIF_IFD_GPS },
1717     { "GPSDifferential", EXIF_IFD_GPS },
1718     { "GPSHPositioningError", EXIF_IFD_GPS }
1719 };
1720 HWTEST_F(ExifMetadataTest, GetIFD001, TestSize.Level3)
1721 {
1722     for (const auto &it : IFDTable) {
1723         auto ifd = exif_ifd_from_name(it.first.c_str());
1724         ASSERT_EQ(ifd, it.second);
1725     }
1726 }
1727 
1728 std::string g_RemoveBatch001[] = {
1729     {"ImageLength"},
1730     {"HwMnoteCaptureMode"},
1731     {"MovingPhotoId"},
1732     {"MovingPhotoVersion"},
1733     {"MicroVideoPresentationTimestampUS"},
1734 };
1735 
1736 HWTEST_F(ExifMetadataTest, RemoveBatch001, TestSize.Level3)
1737 {
1738     auto exifData = exif_data_new_from_file(IMAGE_INPUT_JPEG_RM_ENTRY_PATH.c_str());
1739     ASSERT_NE(exifData, nullptr);
1740     std::string DEFAULT_EXIF_VALUE = "default_exif_value";
1741     ExifMetadata metadata(exifData);
1742     int rows = sizeof(g_RemoveBatch001) / sizeof(g_RemoveBatch001[0]);
1743     for (int i = 0; i < rows; ++i) {
1744         std::string value;
1745         int ret = metadata.GetValue(g_RemoveBatch001[i], value);
1746         printf("remove entry '%s' before, get value: %s\n", g_RemoveBatch001[i].c_str(), value.c_str());
1747         ASSERT_NE(value, DEFAULT_EXIF_VALUE);
1748 
1749         printf("remove entry: %s\n", g_RemoveBatch001[i].c_str());
1750         auto isRemoved = metadata.RemoveEntry(g_RemoveBatch001[i]);
1751         ASSERT_TRUE(isRemoved);
1752 
1753         ret = metadata.GetValue(g_RemoveBatch001[i], value);
1754         printf("remove entry '%s' after, get value: %s\n", g_RemoveBatch001[i].c_str(), value.c_str());
1755         if (i == 0) {
1756             ASSERT_EQ(value, "");
1757         } else {
1758             ASSERT_EQ(value, DEFAULT_EXIF_VALUE);
1759         }
1760     }
1761 }
1762 
1763 } // namespace Multimedia
1764 } // namespace OHOS
1765