forked from pgf-tikz/pgf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh-1102.lvt
76 lines (60 loc) · 2.35 KB
/
gh-1102.lvt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
\documentclass{minimal}
\input{pgf-regression-test}
\RequirePackage{tikz}
\usetikzlibrary{calc, matrix}
\begin{document}
\setbox0=\hbox{$()$} % avoid logging font info cmex10 at test for "matrix delimiters"
\START
\SEPARATOR
\TYPE{Testing that special nodes are placed at expected position^^J%
when main nodes are implicitly positioned.}
\SEPARATOR
\BEGINTEST{labels}
% adapted from https://github.com/pgf-tikz/pgf/issues/126
\begin{tikzpicture}[L/.style={label={[name=#1]above:{.}}}]
\draw (0,4) -- (3,4) node[midway, L=a] (A) {A};
\draw (0,3) -- node[L=b] (B) {B} (3,3);
\draw (0,2) -- (3,2) node[near end, L=c] (C) {C};
\draw (0,1) -- node[near end, L=d] (D) {D} (3,1);
% `label distance` is initially 0pt
\AssertTikzPointEquals{(a.south)}{(A.north)}
\AssertTikzPointEquals{(b.south)}{(B.north)}
\AssertTikzPointEquals{(c.south)}{(C.north)}
\AssertTikzPointEquals{(d.south)}{(D.north)}
\end{tikzpicture}
\ENDTEST
\BEGINTEST{pins}
\catcode`\@=11\relax
\def\distance{\tikz@pin@distance}
\catcode`\@=12\relax
\begin{tikzpicture}[P/.style={pin={[name=#1]above:{.}}}]
\draw (0,4) -- (3,4) node[midway, P=a] (A) {A};
\draw (0,3) -- node[P=b] (B) {B} (3,3);
\draw (0,2) -- (3,2) node[near end, P=c] (C) {C};
\draw (0,1) -- node[near end, P=d] (D) {D} (3,1);
\AssertTikzPointEquals{(a.south)}{($ (A.north) + (0pt,\distance) $)}
\AssertTikzPointEquals{(b.south)}{($ (B.north) + (0pt,\distance) $)}
\AssertTikzPointEquals{(c.south)}{($ (C.north) + (0pt,\distance) $)}
\AssertTikzPointEquals{(d.south)}{($ (D.north) + (0pt,\distance) $)}
\end{tikzpicture}
\ENDTEST
\BEGINTEST{matrix delimiters}
% adapted from https://github.com/pgf-tikz/pgf/issues/1102
\begin{tikzpicture}[ampersand replacement=\&,
every left delimiter/.style={name=left},
every right delimiter/.style={name=right},
every above delimiter/.style={name=above},
every below delimiter/.style={name=below}]
\draw[->] (0, 0) --
node[matrix of math nodes, anchor=north,
left delimiter=(, right delimiter=),
above delimiter=\{, below delimiter=\}] (M)
{0 \& -1 \\ 1 \& 0 \\}
(1, 0);
\AssertTikzPointEquals{(M.south west)}{(left.south east)}
\AssertTikzPointEquals{(M.south east)}{(right.south west)}
\AssertTikzPointEquals{(M.north west)}{(above.south east)}
\AssertTikzPointEquals{(M.south west)}{(below.south west)}
\end{tikzpicture}
\ENDTEST
\END