Skip to content

Commit 6bd62b3

Browse files
committed
Fix photo date test
1 parent 8b07973 commit 6bd62b3

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

app/src/test/kotlin/com/darkrockstudios/app/securecamera/imagemanager/SecureImageRepositoryTest.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ class SecureImageRepositoryTest {
723723
val galleryDir = secureImageRepository.getGalleryDirectory()
724724
galleryDir.mkdirs()
725725

726-
val photoName = "photo_20230101_120000_00.jpg"
726+
val photoName = "img_550e8400e29b41d4a716446655440000.jpg"
727727
val photoFile = File(galleryDir, photoName)
728728

729729
// Create an encrypted file
@@ -733,24 +733,23 @@ class SecureImageRepositoryTest {
733733
targetFile = photoFile,
734734
)
735735

736+
// Timestamp for 2023-01-01 12:00:00 UTC
737+
val expectedTimestamp = 1672574400000L
738+
736739
val photoDef = PhotoDef(
737740
photoName = photoName,
738741
photoFormat = "jpg",
739-
photoFile = photoFile
742+
photoFile = photoFile,
743+
metadataTimestamp = expectedTimestamp
740744
)
741745

742746
// When
743747
val result = secureImageRepository.getPhotoMetaData(photoDef)
744748

745749
// Then
746750
assertEquals(photoName, result.name)
747-
// The date should be parsed from the photo name
748-
assertEquals(2023, result.dateTaken.year + 1900) // Java Date year is offset by 1900
749-
assertEquals(0, result.dateTaken.month) // Java Date month is 0-based (0 = January)
750-
assertEquals(1, result.dateTaken.date) // day of month
751-
assertEquals(12, result.dateTaken.hours)
752-
assertEquals(0, result.dateTaken.minutes)
753-
assertEquals(0, result.dateTaken.seconds)
751+
// The date should come from the metadataTimestamp
752+
assertEquals(expectedTimestamp, result.dateTaken.time)
754753
// Check the new properties
755754
assertNull(result.orientation)
756755
assertNull(result.location)

0 commit comments

Comments
 (0)