test-photogal.el 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. (load "/Users/jwd/code/photo-gal/photogal.el")
  2. (setq photogaltest-example-operating-table
  3. '((filepath "/Photos/comp.png"
  4. tags nil name nil folders nil)
  5. (filepath "/Photos/e06de5-5501,240622--_art_computer_good_meme_photography_politics_portrait_reaction-photo_screenshot_selfie_.png"
  6. tags nil name nil folders nil)
  7. (filepath "/Photos/e99e1a-5501,240622-como-_art_cityscape_computer_family_meme_politics_reaction-photo_screenshot_selfie_.jpg"
  8. tags nil name nil folders)
  9. (filepath "/Photos/rsf.png"
  10. tags nil name nil folders nil)))
  11. (ert-deftest file-properties-test ()
  12. (let
  13. ((*photogal/operating-table*
  14. photogaltest-example-operating-table))
  15. (should (eq (photogal-get-tags-for-file "/Photos/comp.png")
  16. '()))
  17. (should (eq (photogal-get-name-for-file "/Photos/comp.png")
  18. nil))
  19. ;; ADD THE TAG TO THE SYSTEM
  20. (photogal--add-tag "on" "o")
  21. ;; TOGGLE THE FLAG ON FOR A PHOTO
  22. (photogal-for-file-toggle-tag "/Photos/comp.png" "on")
  23. (should (equal (photogal-get-tags-for-file "/Photos/comp.png")
  24. '("on")))
  25. ;; TOGGLE IT BACK OFF
  26. (photogal-for-file-toggle-tag "/Photos/comp.png" "on")
  27. (should (eq (photogal-get-tags-for-file "/Photos/comp.png")
  28. '()))))
  29. (defvar *photogal/operating-photo-dir* nil)
  30. (ert-deftest destination-folder-test ()
  31. (let
  32. ((*photogal/operating-table*
  33. photogaltest-example-operating-table))
  34. (should (eq (photogal-get-folders-for-file "/Photos/comp.png")
  35. '()))
  36. (photogal-add-folder-for-file "/Photos/comp.png" "Trash")
  37. (should (equal (photogal-get-folders-for-file "/Photos/comp.png")
  38. '("Trash")))
  39. ))