Commit Graph

33 Commits (208788de28150f1ceba5fbfa2f3fc5f191ac3258)

Author SHA1 Message Date
Dustin Oprea c8c0acaebc Use global for name of test image
- Moved logic from common_test.go to testing_common.go . That was legacy
  naming.
2020-01-01 10:05:56 -05:00
Dustin Oprea 78e9e28053 ifd_enumerate_test.go: Moved and refactored some ITEVR tests to be for ValueContext instead
Per our recent change to deimplement ITEVRs.

- ifd_enumerate_test.go: Fixed some test naming.
- ifd_builder_test.go: Dropped some now-unnecessary implementations of
  ITEVRs.
2020-01-01 02:22:28 -05:00
Dustin Oprea 88612c1cf8 ifd_builder.go: No longer use ITEVRs
This was an early way of resolving tag values that is now obsolete.
`ValueContext` structs should be used, and these, in many cases, should
be able to be constructed from the current context without passing
additional arguments.

- ifd_builder_test.go: Refactors to several tests due to loss of ITEVR support.
- ifd_builder_encode_test.go: Moved test-IB populate to testing_common.go .
- ifd_builder.go: Fixed test naming (in most cases, omitted type name).
2020-01-01 00:16:11 -05:00
Dustin Oprea d9ab04aa47 utility.go: Add ExifFullTimestampString
- Added time examples.
- Added comments.
2019-03-06 11:58:49 -05:00
Dustin Oprea 8dfa922c47 ifd_builder_test.go: Simplified example. 2019-02-26 12:58:27 -05:00
Dustin Oprea 467b10f9db fd_builder_test.go: Add writer example
Closes #9
2019-02-26 12:23:39 -05:00
Dustin Oprea 9068786204 Rewired to use IFD-path strings instead of IfdIdentities.
- These are absolute representations of where an IFD is positioned with
  respect to the other IFDs. There is a more-specific, "fully-qualified"
  form of the IFD-path that allows you to express indices in order to
  refer to specific siblings.

- Eliminates issues with IFDs at different levels potentially having the
  same name (if that's what is required with a certain dataset/
  datasource).

- There is a specific IFD registry that controls the heirarchy of IFDs
  that we recognize and the tags associated with the child IFDs. This
  allows custom hierarchies replacing even the TIFF specification for
  which are expected in an image (so we can read other types of images
  or any potential IFD hierarchy, even non-image ones).

- IFD and IB instances embed the IFD-path and FQ IFD-path that they were
  found or built for.
2018-08-01 08:35:21 -04:00
Dustin Oprea d3b45fae77 We now have to pass a specific tag-index in from the top.
- This will allow us to handle custom tags and, with a little more work,
  custom IFDs.
2018-07-26 22:45:43 -04:00
Dustin Oprea 1c95c159fb ifd_builder: Renamed "FromConfig" functions.
- ..to use the word "Standard" instead, instead of having both.
- Removed original NewStandardBuilderTag function. Just used by a couple
  of tests and it conflicts with one of the renamings.
2018-06-06 19:00:53 -04:00
Dustin Oprea 7745cfe74c exif: Deimplemented IsExif().
- exif
  - Began deconstructing Exif type in favor of just defining those
    methods as functions.
  - Added additional tests.
2018-06-06 04:37:43 -04:00
Dustin Oprea 570c4d582c ifd_builder: renamed builderTag to BuilderTag.
- It's probably a generally good idea.
  - These are usually created by other methods, but they're regularly
    interacted with when you want to make tag changes and by making them
    private we can't public official, testable examples.

- Corrected names for new examples.
2018-05-29 14:47:30 -04:00
Dustin Oprea b7368b1fb4 ifd_enumerate: Implemented ChildWithIfdIdentity. 2018-05-29 03:45:09 -04:00
Dustin Oprea dc6bb3e4b1 ifd_builder: Fixed test. 2018-05-29 02:15:18 -04:00
Dustin Oprea 6a9c7f28b1 ifd_builder: Added test for tag update.
- Added get-thumbnail and update-tag examples.
2018-05-29 02:09:01 -04:00
Dustin Oprea abbf7e0d92 ifd_builder: `builderTag` is now passed by reference. 2018-05-29 01:32:09 -04:00
Dustin Oprea 0a561e98ed Fixed tests for recent changes. 2018-05-29 00:55:43 -04:00
Dustin Oprea 3c1c668a9f encode: We now encode child IFDs as they occur.
- ..rather than after the normal tags.
2018-05-28 20:04:02 -04:00
Dustin Oprea 843976865e ifdBuilder.dumpToStrings: Fixed usage of II.
- We were ambiguously treating it as both the parent II in some places
  and the child II in others. It's supposed to be the parent II.
2018-05-24 01:58:58 -04:00
Dustin Oprea e3c96766ca tests: Fixed tests for recent changes. One remaining. 2018-05-22 09:39:03 -04:00
Dustin Oprea 75b2c75c5a ifd_builder_encode: Added tests for encoding child IBs to EXIF.
- Big step. This is the most complicated thing we can do.
- ifd_builder_encode: Need to debug encoding linked IFDs to EXIF.
- ifd_builder: Renamed `SetNextIfd()` to `SetNextIb()`.
- ifd_builder: Bugfix to size assertion on return of
  (IfdBuilderEncode).encodeIfdToBytes().
- ifd_enumerate: Rename PrintNode() to PrintTree().
- ifd_enumerate: Added DumpTree() (to return a list of strings).
2018-05-03 12:43:06 -04:00
Dustin Oprea b75f980bc4 ifd_enumerate: Create II when `Ifd` is constructed.
- ..rather than on-the-fly. Now efficient, especially now that it's used
  for find operations.
2018-05-03 11:13:34 -04:00
Dustin Oprea 8c09d04212 ifd_enumerate: Added find-by-id and find-by-name to tags in `ifd`.
- Made `(Ifd).Entries` a slice of pointers ([]*IfdTagEntry).
2018-05-03 04:09:06 -04:00
Dustin Oprea 35ddc4f803 ifd_builder_encode: Fixed tests from previous change.
- Simplified `builderTag` use.
2018-05-02 07:04:47 -04:00
Dustin Oprea 16586eb8cb ifd_builder: Now embed type in `builderTag`.
- We were automatically looking this up but this will prevent users from
  having a mechanism to use custom tags.
2018-05-02 06:40:36 -04:00
Dustin Oprea 54e4cb73eb IfdBuilder: Added AddFromConfigWithName().
- IfdBuilder: Added NewBuilderTagFromConfigWithName().
- TagIndex: Added GetWithName().
- IfdByteEncoder: Updated example to use names.
2018-05-01 12:22:48 -04:00
Dustin Oprea d06a3c8963 ifd_builder: Implemented NewBuilderTagFromConfig() BT factory for testing.
- Updated IfdByteEncoder tests to use it instead of hacking-together
  their own BT's (makes for more standardized, consistent testing).

- Universally refactored all core IFD knowledge implemented upon a
  single IFD name to instead work with IfdIdentity instances, instead,
  in order to validate that we only recognize the IFDs only in the
  context of the correct parents in the hierarchy.

- Implemented standard testing byte-order (assigned to
  TestDefaultByteOrder).
2018-04-27 03:42:59 -04:00
Dustin Oprea cabbc2fca1 ifd_builder: Added tests for ancillary builder logic. 2018-04-25 04:32:58 -04:00
Dustin Oprea d035d20098 ifd_builder: value is now guaranteed to be a byte-slice or child-IFD.
- Using an interface{} required us to validate the encapsulated type or
  risk forgetting to.

- AddTagsFromExisting now just copies the bytes verbatim if no value-
  resolver provided.
2018-04-23 23:58:37 -04:00
Dustin Oprea 098862d2f9 ifd_builder: Added NewIfdBuilderWithExistingIfd test. 2018-04-23 22:07:13 -04:00
Dustin Oprea 4bea09dc78 ifd_builder: Can now build a complete chain from existing EXIF.
- ifd_builder:
  - We now validate that `builderTag` instances are either a byte array
    or a child Ifd before allowing to add.
  - Renamed `builderTag.valueBytes` to `builderTag.value` (it's not
    necessarily bytes).
  - `builderTag` now gets the child IFD name if representing a child
    IFD.
  - Added ability to dump structure to string slice.
  - Added NewIfdBuilderFromExistingChain to reconstruct whole chain
    from a read IFD chain (collection).
  - Wrote IB dumper.
  - Added structural tests.
  - Moved ifd_tag_entry types to separate file.

- tags_unknown: Unknown-type tags can now satisfy the `UnknownTagValue`
interface to return `[]byte`.
  - `IfdTagEntry.ValueBytes` automatically uses this. Else, error if not
    `[]byte` or `string`.

- ifd_enumerate
  - Now embed `ByteOrder` in `Ifd` (we otherwise require it to be passed
    a bit too often).

- Renamed some occurences of "IFD" to "IB" where an actual IB in order
  to not be confusing.
2018-04-23 04:53:51 -04:00
Dustin Oprea 50eafa98d6 ifd_enumerate: Added tests.
- Refactored (IfdTagEntry).ValueBytes() to handle managed undefined
  values.
2018-04-22 02:35:33 -04:00
Dustin Oprea f9267550eb ifd_builder: Added renaming tests. 2018-04-20 04:16:48 -04:00
Dustin Oprea b5299427bc ifd_builder: Added tests for creating and adding. 2018-04-19 04:04:19 -04:00