File tree Expand file tree Collapse file tree 2 files changed +43
-6
lines changed Expand file tree Collapse file tree 2 files changed +43
-6
lines changed Original file line number Diff line number Diff line change @@ -138,12 +138,19 @@ public function testMapRawDataCorrectlyIgnoresIncorrectCreationDate()
138138 public function testMapRawDataCorrectlyFormatsExposureTime ()
139139 {
140140 $ rawData = array (
141- \PHPExif \Mapper \Exiftool::EXPOSURETIME => 1 /400 ,
141+ '1/30 ' => 10 /300 ,
142+ '1/400 ' => 2 /800 ,
143+ '1/400 ' => 1 /400 ,
144+ '0 ' => 0 ,
142145 );
143146
144- $ mapped = $ this ->mapper ->mapRawData ($ rawData );
147+ foreach ($ rawData as $ expected => $ value ) {
148+ $ mapped = $ this ->mapper ->mapRawData (array (
149+ \PHPExif \Mapper \Exiftool::EXPOSURETIME => $ value ,
150+ ));
145151
146- $ this ->assertEquals ('1/400 ' , reset ($ mapped ));
152+ $ this ->assertEquals ($ expected , reset ($ mapped ));
153+ }
147154 }
148155
149156 /**
Original file line number Diff line number Diff line change @@ -108,12 +108,19 @@ public function testMapRawDataCorrectlyIgnoresIncorrectDateTimeOriginal()
108108 public function testMapRawDataCorrectlyFormatsExposureTime ()
109109 {
110110 $ rawData = array (
111- \PHPExif \Mapper \Native::EXPOSURETIME => '2/800 ' ,
111+ '1/30 ' => 10 /300 ,
112+ '1/400 ' => 2 /800 ,
113+ '1/400 ' => 1 /400 ,
114+ '0 ' => 0 ,
112115 );
113116
114- $ mapped = $ this ->mapper ->mapRawData ($ rawData );
117+ foreach ($ rawData as $ expected => $ value ) {
118+ $ mapped = $ this ->mapper ->mapRawData (array (
119+ \PHPExif \Mapper \Native::EXPOSURETIME => $ value ,
120+ ));
115121
116- $ this ->assertEquals ('1/400 ' , reset ($ mapped ));
122+ $ this ->assertEquals ($ expected , reset ($ mapped ));
123+ }
117124 }
118125
119126 /**
@@ -251,4 +258,27 @@ public function testMapRawDataCorrectlyIgnoresInvalidCreateDate()
251258 $ result
252259 );
253260 }
261+
262+ /**
263+ * @group mapper
264+ * @covers \PHPExif\Mapper\Native::normalizeComponent
265+ */
266+ public function testNormalizeComponentCorrectly ()
267+ {
268+ $ reflMethod = new \ReflectionMethod ('\PHPExif\Mapper\Native ' , 'normalizeComponent ' );
269+ $ reflMethod ->setAccessible (true );
270+
271+ $ rawData = array (
272+ '2/800 ' => 0.0025 ,
273+ '1/400 ' => 0.0025 ,
274+ '0/1 ' => 0 ,
275+ '0 ' => 0 ,
276+ );
277+
278+ foreach ($ rawData as $ value => $ expected ) {
279+ $ normalized = $ reflMethod ->invoke ($ this ->mapper , $ value );
280+
281+ $ this ->assertEquals ($ expected , $ normalized );
282+ }
283+ }
254284}
You can’t perform that action at this time.
0 commit comments