Commits

P_W999  committed ecf73c3

- simple unit test for copyFrom and timeShift method

  • Participants
  • Parent commits a987b7b

Comments (0)

Files changed (1)

File test/be/pw/jexif/JExifToolTest.java

 import org.testng.annotations.Test;
 
 import be.pw.jexif.enums.DataType;
+import be.pw.jexif.enums.DateTag;
 import be.pw.jexif.enums.tag.ExifIFD;
 import be.pw.jexif.enums.tag.IFD0;
 import be.pw.jexif.enums.tag.Tag;
 	    new JExifTool();
 	}
 	
+	@Test(groups = {"simple", "write"})
+	public void testTimeShift() throws Exception {
+	    JExifInfo i = tool.getInfo(write02);
+	    assertThat(i.getTagValue(ExifIFD.CREATEDATE)).isNotNull().isNotEmpty().isEqualTo("2011:11:07 16:16:50");
+	    i.timeShift(DateTag.CREATEDATE, "1:: 1::");
+	    assertThat(i.getTagValue(ExifIFD.CREATEDATE)).isNotNull().isNotEmpty().isEqualTo("2012:11:07 17:16:50");
+	}
+	
+	@Test(groups = {"simple", "write"})
+    public void testCopyFromOne() throws Exception {
+        JExifInfo i = tool.getInfo(write02);
+        i.copyFrom(tool.getInfo(read01), IFD0.MODEL);
+        assertThat(i.getTagValue(IFD0.MODEL)).isEqualTo("EX-FH100");
+    }
+	
+	@Test(groups = {"simple", "write"})
+    public void testCopyFromTwo() throws Exception {
+	    JExifInfo i = tool.getInfo(write02);
+        i.copyFrom(tool.getInfo(read01), IFD0.MODEL, ExifIFD.EXPOSUREPROGRAM);
+        assertThat(i.getTagValue(IFD0.MODEL)).isEqualTo("EX-FH100");
+        assertThat(i.getTagValue(ExifIFD.EXPOSUREPROGRAM)).isEqualTo("Program AE");
+    }
+	
+	@Test(groups = {"simple", "write"})
+    public void testCopyFromAll() throws Exception {
+	    JExifInfo i = tool.getInfo(write02);
+        i.copyFrom(tool.getInfo(read01));
+        assertThat(i.getTagValue(IFD0.MODEL)).isEqualTo("EX-FH100");
+        assertThat(i.getTagValue(ExifIFD.EXPOSUREPROGRAM)).isEqualTo("Program AE");
+    }
+	
 	@AfterClass
 	public void afterClass() {
 	}