Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e8178a9

Browse filesBrowse files
committed
[[ Bug 21219 ]] selectedLine behavior tests
This patch adds tests to compare the behavior of `the selectedLine` to the behavior of an explicit line chunk.
1 parent 6de2d37 commit e8178a9
Copy full SHA for e8178a9

File tree

1 file changed

+175
-0
lines changed
Filter options

1 file changed

+175
-0
lines changed
+175Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
script "CoreFieldSelectedLine"
2+
/*
3+
Copyright (C) 2018 LiveCode Ltd.
4+
5+
This file is part of LiveCode.
6+
7+
LiveCode is free software; you can redistribute it and/or modify it under
8+
the terms of the GNU General Public License v3 as published by the Free
9+
Software Foundation.
10+
11+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
12+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
18+
19+
on TestSetup
20+
create stack "Test"
21+
set the defaultStack to "Test"
22+
create field "Test"
23+
end TestSetup
24+
25+
private command __ResetField
26+
put format("a\nb\nc\nd\ne\nf\ng\nh\n") into field "Test"
27+
end __ResetField
28+
29+
on TestCutSelectedLine
30+
set the defaultStack to "Test"
31+
__ResetField
32+
cut line 4 of field "Test"
33+
TestAssert "cut line removes line", the text of field "Test" is format("a\nb\nc\ne\nf\ng\nh\n")
34+
TestDiagnostic the text of field "Test"
35+
TestAssert "cut line includes line delimiter", the clipboardData["text"] is "d" & return
36+
TestDiagnostic the clipboardData["text"]
37+
38+
__ResetField
39+
select before line 4 of field "Test"
40+
cut the selectedline
41+
TestAssert "cut selectedLine removes line", the text of field "Test" is format("a\nb\nc\ne\nf\ng\nh\n")
42+
TestDiagnostic the text of field "Test"
43+
TestAssert "cut selectedLine includes line delimiter", the clipboardData["text"] is "d" & return
44+
TestDiagnostic the clipboardData["text"]
45+
46+
__ResetField
47+
select line 4 of field "Test"
48+
cut
49+
TestAssert "select line then cut removes line", the text of field "Test" is format("a\nb\nc\ne\nf\ng\nh\n")
50+
TestDiagnostic the text of field "Test"
51+
TestAssert "cut line includes line delimiter", the clipboardData["text"] is "d" & return
52+
TestDiagnostic the clipboardData["text"]
53+
54+
__ResetField
55+
select before line 4 of field "Test"
56+
select the selectedline
57+
cut
58+
TestAssert "select selectedLine then cut removes line", the text of field "Test" is format("a\nb\nc\ne\nf\ng\nh\n")
59+
TestDiagnostic the text of field "Test"
60+
TestAssert "cut selectedLine includes line delimiter", the clipboardData["text"] is "d" & return
61+
TestDiagnostic the clipboardData["text"]
62+
end TestCutSelectedLine
63+
64+
on TestDeleteSelectedLine
65+
set the defaultStack to "Test"
66+
__ResetField
67+
delete line 4 of field "Test"
68+
TestAssert "delete line removes line", the text of field "Test" is format("a\nb\nc\ne\nf\ng\nh\n")
69+
TestDiagnostic the text of field "Test"
70+
71+
__ResetField
72+
select before line 4 of field "Test"
73+
delete the selectedLine
74+
TestAssert "select the selectedLine then delete removes line", the text of field "Test" is format("a\nb\nc\ne\nf\ng\nh\n")
75+
end TestDeleteSelectedLine
76+
77+
on TestHiddenPropertyOfSelectedLine
78+
set the defaultStack to "Test"
79+
__ResetField
80+
set the hidden of line 4 of field "Test" to true
81+
TestAssert "hidden property of line is correct", the hidden of line 4 of field "Test" is true
82+
TestAssert "hidden property of line is correct after", the hidden of line 5 of field "Test" is false
83+
TestAssert "hidden property of line is correct before", the hidden of line 3 of field "Test" is false
84+
85+
__ResetField
86+
select before line 4 of field "Test"
87+
set the hidden of the selectedLine to true
88+
TestAssert "hidden property of selectedLine is correct", the hidden of line 4 of field "Test" is true
89+
TestAssert "hidden property of selectedLine is correct after", the hidden of line 5 of field "Test" is false
90+
TestAssert "hidden property of selectedLine is correct before", the hidden of line 3 of field "Test" is false
91+
end TestHiddenPropertyOfSelectedLine
92+
93+
on TestListStylePropertyOfSelectedLine
94+
set the defaultStack to "Test"
95+
__ResetField
96+
set the listStyle of line 4 of field "Test" to "disc"
97+
TestAssert "listStyle property of line is correct", the listStyle of line 4 of field "Test" is "disc"
98+
TestAssert "listStyle property of line is correct after", the listStyle of line 5 of field "Test" is empty
99+
TestAssert "listStyle property of line is correct before", the listStyle of line 3 of field "Test" is empty
100+
101+
__ResetField
102+
select before line 4 of field "Test"
103+
set the listStyle of the selectedLine to "disc"
104+
TestAssert "listStyle property of selectedLine is correct", the listStyle of line 4 of field "Test" is "disc"
105+
TestAssert "listStyle property of selectedLine is correct after", the listStyle of line 5 of field "Test" is empty
106+
TestAssert "listStyle property of selectedLine is correct before", the listStyle of line 3 of field "Test" is empty
107+
end TestListStylePropertyOfSelectedLine
108+
109+
on TestPutIntoSelectedLine
110+
set the defaultStack to "Test"
111+
__ResetField
112+
put "i" into line 4 of field "Test"
113+
TestAssert "put into line replaces text of line", the text of field "Test" is format("a\nb\nc\ni\ne\nf\ng\nh\n")
114+
TestDiagnostic the text of field "Test"
115+
116+
__ResetField
117+
select before line 4 of field "Test"
118+
put "i" into the selectedLine
119+
TestAssert "put into selectedLine replaces text of line", the text of field "Test" is format("a\nb\nc\ni\ne\nf\ng\nh\n")
120+
TestDiagnostic the text of field "Test"
121+
end TestPutIntoSelectedLine
122+
123+
on TestPutBeforeSelectedLine
124+
set the defaultStack to "Test"
125+
__ResetField
126+
put "i" before line 4 of field "Test"
127+
TestAssert "put before line inserts text before line", the text of field "Test" is format("a\nb\nc\nid\ne\nf\ng\nh\n")
128+
TestDiagnostic the text of field "Test"
129+
130+
__ResetField
131+
select before line 4 of field "Test"
132+
put "i" before the selectedLine
133+
TestAssert "put before selectedLine inserts text before line", the text of field "Test" is format("a\nb\nc\nid\ne\nf\ng\nh\n")
134+
TestDiagnostic the text of field "Test"
135+
end TestPutBeforeSelectedLine
136+
137+
on TestPutAfterSelectedLine
138+
set the defaultStack to "Test"
139+
__ResetField
140+
put "i" after line 4 of field "Test"
141+
TestAssert "put after line inserts text after line", the text of field "Test" is format("a\nb\nc\ndi\ne\nf\ng\nh\n")
142+
TestDiagnostic the text of field "Test"
143+
144+
__ResetField
145+
select before line 4 of field "Test"
146+
put "i" after the selectedLine
147+
TestAssert "put after selectedLine inserts text after line", the text of field "Test" is format("a\nb\nc\ndi\ne\nf\ng\nh\n")
148+
TestDiagnostic the text of field "Test"
149+
end TestPutAfterSelectedLine
150+
151+
on TestCopySelectedLine
152+
set the defaultStack to "Test"
153+
__ResetField
154+
copy line 4 of field "Test"
155+
TestAssert "copy line includes line delimiter", the clipboardData["text"] is "d" & return
156+
TestDiagnostic the clipboardData["text"]
157+
158+
__ResetField
159+
select before line 4 of field "Test"
160+
copy the selectedLine
161+
TestAssert "copy selectedLine includes line delimiter", the clipboardData["text"] is "d" & return
162+
TestDiagnostic the clipboardData["text"]
163+
end TestCopySelectedLine
164+
165+
on TestSelectedLineRoundTrip
166+
set the defaultStack to "Test"
167+
__ResetField
168+
select before line 4 of field "Test"
169+
TestAssert "selectedLine correct after select before line", the selectedLine is "line 4 of field 1"
170+
TestDiagnostic the selectedLine
171+
172+
select the selectedLine
173+
TestAssert "selectedLine round trips with select the selectedLine", the selectedLine is "line 4 of field 1"
174+
TestDiagnostic the selectedLine
175+
end TestSelectedLineRoundTrip

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.