[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed a7cbce6 107/389: Test subed-move-subtitle-forward/ba
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed a7cbce6 107/389: Test subed-move-subtitle-forward/backward more thoroughly |
Date: |
Fri, 3 Dec 2021 11:00:07 -0500 (EST) |
branch: elpa/subed
commit a7cbce621b3c5818a8362cb767954d96886dc9ef
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>
Test subed-move-subtitle-forward/backward more thoroughly
---
tests/test-subed.el | 84 +++++++++++++++++++++++++++++++++++++----------------
1 file changed, 59 insertions(+), 25 deletions(-)
diff --git a/tests/test-subed.el b/tests/test-subed.el
index c4ec7d0..94085fd 100644
--- a/tests/test-subed.el
+++ b/tests/test-subed.el
@@ -94,31 +94,65 @@
(subed-move-subtitle-backward 100)
(expect (subed--subtitle-msecs-start) :to-equal
orig-start)
(expect (subed--subtitle-msecs-stop) :to-equal
orig-stop)))))
- (it "adjusts subtitles in the active region."
- (with-temp-buffer
- (insert mock-srt-data)
- (let ((beg (subed-jump-to-subtitle-text 2))
- (end (subed-jump-to-subtitle-time-start 3))
- (orig-start-1 (subed--subtitle-msecs-start 1))
- (orig-stop-1 (subed--subtitle-msecs-stop 1))
- (orig-start-2 (subed--subtitle-msecs-start 2))
- (orig-stop-2 (subed--subtitle-msecs-stop 2))
- (orig-start-3 (subed--subtitle-msecs-start 3))
- (orig-stop-3 (subed--subtitle-msecs-stop 3)))
- (subed-move-subtitle-forward 100 beg end)
- (expect (subed--subtitle-msecs-start 1) :to-equal
orig-start-1)
- (expect (subed--subtitle-msecs-stop 1) :to-equal orig-stop-1)
- (expect (subed--subtitle-msecs-start 2) :to-equal (+
orig-start-2 100))
- (expect (subed--subtitle-msecs-stop 2) :to-equal (+
orig-stop-2 100))
- (expect (subed--subtitle-msecs-start 3) :to-equal (+
orig-start-3 100))
- (expect (subed--subtitle-msecs-stop 3) :to-equal (+
orig-stop-3 100))
- (subed-move-subtitle-backward 100 beg end)
- (expect (subed--subtitle-msecs-start 1) :to-equal
orig-start-1)
- (expect (subed--subtitle-msecs-stop 1) :to-equal orig-stop-1)
- (expect (subed--subtitle-msecs-start 2) :to-equal
orig-start-2)
- (expect (subed--subtitle-msecs-stop 2) :to-equal orig-stop-2)
- (expect (subed--subtitle-msecs-start 3) :to-equal
orig-start-3)
- (expect (subed--subtitle-msecs-stop 3) :to-equal
orig-stop-3))))
+ (describe "adjusts subtitles in the active region,"
+ (it "excluding the first subtitle."
+ (with-temp-buffer
+ (insert mock-srt-data)
+ (let ((beg (subed-jump-to-subtitle-text 2))
+ (end (subed-jump-to-subtitle-time-start 3))
+ (orig-start-1 (subed--subtitle-msecs-start 1))
+ (orig-stop-1 (subed--subtitle-msecs-stop 1))
+ (orig-start-2 (subed--subtitle-msecs-start 2))
+ (orig-stop-2 (subed--subtitle-msecs-stop 2))
+ (orig-start-3 (subed--subtitle-msecs-start 3))
+ (orig-stop-3 (subed--subtitle-msecs-stop 3)))
+ (spy-on 'use-region-p :and-return-value t)
+ (spy-on 'region-beginning :and-return-value beg)
+ (spy-on 'region-end :and-return-value end)
+ (subed-move-subtitle-forward 100)
+ (expect (subed--subtitle-msecs-start 1) :to-equal
orig-start-1)
+ (expect (subed--subtitle-msecs-stop 1) :to-equal
orig-stop-1)
+ (expect (subed--subtitle-msecs-start 2) :to-equal
(+ orig-start-2 100))
+ (expect (subed--subtitle-msecs-stop 2) :to-equal
(+ orig-stop-2 100))
+ (expect (subed--subtitle-msecs-start 3) :to-equal
(+ orig-start-3 100))
+ (expect (subed--subtitle-msecs-stop 3) :to-equal
(+ orig-stop-3 100))
+ (subed-move-subtitle-backward 200)
+ (expect (subed--subtitle-msecs-start 1) :to-equal
orig-start-1)
+ (expect (subed--subtitle-msecs-stop 1) :to-equal
orig-stop-1)
+ (expect (subed--subtitle-msecs-start 2) :to-equal
(- orig-start-2 100))
+ (expect (subed--subtitle-msecs-stop 2) :to-equal
(- orig-stop-2 100))
+ (expect (subed--subtitle-msecs-start 3) :to-equal
(- orig-start-3 100))
+ (expect (subed--subtitle-msecs-stop 3) :to-equal
(- orig-stop-3 100)))))
+ (it "excluding the last subtitle."
+ (with-temp-buffer
+ (insert mock-srt-data)
+ (let ((beg (subed-jump-to-subtitle-time-stop 1))
+ (end (1+ (subed-jump-to-subtitle-end 2)))
+ (orig-start-1 (subed--subtitle-msecs-start 1))
+ (orig-stop-1 (subed--subtitle-msecs-stop 1))
+ (orig-start-2 (subed--subtitle-msecs-start 2))
+ (orig-stop-2 (subed--subtitle-msecs-stop 2))
+ (orig-start-3 (subed--subtitle-msecs-start 3))
+ (orig-stop-3 (subed--subtitle-msecs-stop 3)))
+ (spy-on 'use-region-p :and-return-value t)
+ (spy-on 'region-beginning :and-return-value beg)
+ (spy-on 'region-end :and-return-value end)
+ (subed-move-subtitle-forward 100)
+ (expect (subed--subtitle-msecs-start 1) :to-equal
(+ orig-start-1 100))
+ (expect (subed--subtitle-msecs-stop 1) :to-equal
(+ orig-stop-1 100))
+ (expect (subed--subtitle-msecs-start 2) :to-equal
(+ orig-start-2 100))
+ (expect (subed--subtitle-msecs-stop 2) :to-equal
(+ orig-stop-2 100))
+ (expect (subed--subtitle-msecs-start 3) :to-equal
orig-start-3)
+ (expect (subed--subtitle-msecs-stop 3) :to-equal
orig-stop-3)
+ (subed-move-subtitle-backward 300)
+ (expect (subed--subtitle-msecs-start 1) :to-equal
(- orig-start-1 200))
+ (expect (subed--subtitle-msecs-stop 1) :to-equal
(- orig-stop-1 200))
+ (expect (subed--subtitle-msecs-start 2) :to-equal
(- orig-start-2 200))
+ (expect (subed--subtitle-msecs-stop 2) :to-equal
(- orig-stop-2 200))
+ (expect (subed--subtitle-msecs-start 3) :to-equal
orig-start-3)
+ (expect (subed--subtitle-msecs-stop 3) :to-equal
orig-stop-3)
+ )))
+ )
)
(describe "Syncing player to point"
- [nongnu] elpa/subed 651c6de 031/389: Wrap some function bodies in save-match-data, (continued)
- [nongnu] elpa/subed 651c6de 031/389: Wrap some function bodies in save-match-data, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 57c902a 068/389: subed-srt-sanitize: Don't change buffer unless it's necessary, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 1571de4 070/389: Use prefix arg to set start/stop time adjustment, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed f832a1d 075/389: Add more tests for subed-srt-move-to-subtitle-end, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 8374498 076/389: README: Split feature list and some rewording, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d0708e5 080/389: Fix screenshot, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 03cd2bf 097/389: Wrap msecs-to-timestamp in save-match-data, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 4960c74 098/389: Make timestamp parsing more robust, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 9b95137 104/389: Test subed--for-each-subtitle more thoroughly, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed ec03689 105/389: Fix subed--for-each-subtitle, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed a7cbce6 107/389: Test subed-move-subtitle-forward/backward more thoroughly,
ELPA Syncer <=
- [nongnu] elpa/subed 5da6d79 112/389: Add "pause with key" to features, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 868d05c 114/389: Adjust some variable descriptions, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 6cf5df4 036/389: Remove annoying minibuffer messages, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 3927690 037/389: Some rewording, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 62d5d3d 038/389: Use (unless ...) instead of (when (not ...)), ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 166988c 041/389: Special subtitle separator when moving to end of subtitle, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e471802 046/389: Adjust test description, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 727275d 043/389: subed-srt-sanitize: Wrap function body in atomic-change-group, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed a30a4b1 054/389: subed-srt-regenerate-ids: Don't change buffer unless it's necessary, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 5fd2009 055/389: subed-mpv: Handle invalid JSON, ELPA Syncer, 2021/12/03