aboutsummaryrefslogtreecommitdiffstats
path: root/test/manual
diff options
context:
space:
mode:
Diffstat (limited to 'test/manual')
-rw-r--r--test/manual/indent/css-mode.css27
-rw-r--r--test/manual/indent/scss-mode.scss44
-rw-r--r--test/manual/scroll-tests.el130
3 files changed, 188 insertions, 13 deletions
diff --git a/test/manual/indent/css-mode.css b/test/manual/indent/css-mode.css
index 3a00739bfc4..0845c02c299 100644
--- a/test/manual/indent/css-mode.css
+++ b/test/manual/indent/css-mode.css
@@ -43,3 +43,30 @@ article:hover
43{ 43{
44 color: black; 44 color: black;
45} 45}
46
47/* bug:13425 */
48div:first-child,
49div:last-child,
50div[disabled],
51div::before {
52 font: 15px "Helvetica Neue",
53 Helvetica,
54 Arial,
55 "Nimbus Sans L",
56 sans-serif;
57 font: 15px "Helvetica Neue", Helvetica, Arial,
58 "Nimbus Sans L", sans-serif;
59 transform: matrix(1.0, 2.0,
60 3.0, 4.0,
61 5.0, 6.0);
62 transform: matrix(
63 1.0, 2.0,
64 3.0, 4.0,
65 5.0, 6.0
66 );
67}
68@font-face {
69 src: url("Sans-Regular.eot") format("eot"),
70 url("Sans-Regular.woff") format("woff"),
71 url("Sans-Regular.ttf") format("truetype");
72}
diff --git a/test/manual/indent/scss-mode.scss b/test/manual/indent/scss-mode.scss
index e1ec90a5299..f9911ad11b7 100644
--- a/test/manual/indent/scss-mode.scss
+++ b/test/manual/indent/scss-mode.scss
@@ -16,20 +16,20 @@ nav {
16 } 16 }
17} 17}
18nav ul { 18nav ul {
19 margin: 0; 19 margin: 0;
20 padding: 0; 20 padding: 0;
21 list-style: none; 21 list-style: none;
22} 22}
23 23
24nav li { 24nav li {
25 display: inline-block; 25 display: inline-block;
26} 26}
27 27
28nav a var 28nav a var
29{ 29{
30 display: block; 30 display: block;
31 padding: 6px 12px; 31 padding: 6px 12px;
32 text-decoration: none; 32 text-decoration: none;
33} 33}
34 34
35$name: foo; 35$name: foo;
@@ -67,10 +67,28 @@ button {
67 67
68// bug:21230 68// bug:21230
69$list: ( 69$list: (
70 ('a', #000000, #fff) 70 ('a', #000000, #fff)
71 ('b', #000000, #fff) 71 ('b', #000000, #fff)
72 ('c', #000000, #fff) 72 ('c', #000000, #fff)
73 ('d', #000000, #fff) 73 ('d', #000000, #fff)
74 ('e', #000000, #fff) 74 ('e', #000000, #fff)
75 ('f', #000000, #fff) 75 ('f', #000000, #fff)
76); 76);
77
78// bug:13425
79div:first-child,
80div:last-child {
81 @include foo-mixin(
82 $foo: 'foo',
83 $bar: 'bar',
84 );
85
86 font: 15px "Helvetica Neue", Helvetica, Arial,
87 "Nimbus Sans L", sans-serif;
88
89 div:first-child,
90 div:last-child {
91 font: 15px "Helvetica Neue", Helvetica, Arial,
92 "Nimbus Sans L", sans-serif;
93 }
94}
diff --git a/test/manual/scroll-tests.el b/test/manual/scroll-tests.el
new file mode 100644
index 00000000000..1167efd6a66
--- /dev/null
+++ b/test/manual/scroll-tests.el
@@ -0,0 +1,130 @@
1;;; scroll-tests.el -- tests for scrolling -*- lexical-binding: t -*-
2
3;; Copyright (C) 2017 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; This program is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; This program is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;; These are mostly automated ert tests, but they don't work in batch
23;; mode which is why they are under test/manual.
24
25;;; Code:
26
27(require 'ert)
28(eval-when-compile (require 'cl-lib))
29
30(defun scroll-tests-up-and-down (margin &optional effective-margin)
31 (unless effective-margin
32 (setq effective-margin margin))
33 (erase-buffer)
34 (insert (mapconcat #'number-to-string
35 (number-sequence 1 200) "\n"))
36 (goto-char 1)
37 (sit-for 0)
38 (let ((scroll-margin margin)
39 (wstart (window-start)))
40 ;; Stopping before `scroll-margin' so we shouldn't have
41 ;; scrolled.
42 (let ((current-prefix-arg (- (window-text-height) 1 effective-margin)))
43 (call-interactively 'next-line))
44 (sit-for 0)
45 (should (= wstart (window-start)))
46 ;; Passing `scroll-margin' should trigger scrolling.
47 (call-interactively 'next-line)
48 (sit-for 0)
49 (should (/= wstart (window-start)))
50 ;; Scroll back to top.
51 (let ((current-prefix-arg (window-start)))
52 (call-interactively 'scroll-down-command))
53 (sit-for 0)
54 (should (= 1 (window-start)))))
55
56(defmacro scroll-tests-with-buffer-window (&rest body)
57 (declare (debug t))
58 `(with-temp-buffer
59 (with-selected-window (display-buffer (current-buffer))
60 ,@body)))
61
62(ert-deftest scroll-tests-scroll-margin-0 ()
63 (skip-unless (not noninteractive))
64 (scroll-tests-with-buffer-window
65 (scroll-tests-up-and-down 0)))
66
67(ert-deftest scroll-tests-scroll-margin-negative ()
68 "A negative `scroll-margin' should be the same as 0."
69 (skip-unless (not noninteractive))
70 (scroll-tests-with-buffer-window
71 (scroll-tests-up-and-down -10 0)))
72
73(ert-deftest scroll-tests-scroll-margin-max ()
74 (skip-unless (not noninteractive))
75 (scroll-tests-with-buffer-window
76 (let ((max-margin (/ (window-text-height) 4)))
77 (scroll-tests-up-and-down max-margin))))
78
79(ert-deftest scroll-tests-scroll-margin-over-max ()
80 "A `scroll-margin' more than max should be the same as max."
81 (skip-unless (not noninteractive))
82 (scroll-tests-with-buffer-window
83 (set-window-text-height nil 7)
84 (let ((max-margin (/ (window-text-height) 4)))
85 (scroll-tests-up-and-down (+ max-margin 1) max-margin)
86 (scroll-tests-up-and-down (+ max-margin 2) max-margin))))
87
88(defun scroll-tests--point-in-middle-of-window-p ()
89 (= (count-lines (window-start) (window-point))
90 (/ (1- (window-text-height)) 2)))
91
92(cl-defun scroll-tests--scroll-margin-whole-window (&key with-line-spacing)
93 "Test `maximum-scroll-margin' at 0.5.
94With a high `scroll-margin', this should keep cursor in the
95middle of the window."
96 (let ((maximum-scroll-margin 0.5)
97 (scroll-margin 100))
98 (scroll-tests-with-buffer-window
99 (setq-local line-spacing with-line-spacing)
100 ;; Choose an odd number, so there is one line in the middle.
101 (set-window-text-height nil 7)
102 ;; `set-window-text-height' doesn't count `line-spacing'.
103 (when with-line-spacing
104 (window-resize nil (* line-spacing 7) nil nil 'pixels))
105 (erase-buffer)
106 (insert (mapconcat #'number-to-string
107 (number-sequence 1 200) "\n"))
108 (goto-char 1)
109 (sit-for 0)
110 (call-interactively 'scroll-up-command)
111 (sit-for 0)
112 (should (scroll-tests--point-in-middle-of-window-p))
113 (call-interactively 'scroll-up-command)
114 (sit-for 0)
115 (should (scroll-tests--point-in-middle-of-window-p))
116 (call-interactively 'scroll-down-command)
117 (sit-for 0)
118 (should (scroll-tests--point-in-middle-of-window-p)))))
119
120(ert-deftest scroll-tests-scroll-margin-whole-window ()
121 (skip-unless (not noninteractive))
122 (scroll-tests--scroll-margin-whole-window))
123
124(ert-deftest scroll-tests-scroll-margin-whole-window-line-spacing ()
125 ;; `line-spacing' has no effect on tty displays.
126 (skip-unless (display-graphic-p))
127 (scroll-tests--scroll-margin-whole-window :with-line-spacing 3))
128
129
130;;; scroll-tests.el ends here