emacs-elpa-diffs
[Top][All Lists]
Advanced

[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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]