-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.typ
289 lines (262 loc) · 7.08 KB
/
template.typ
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#import "@preview/numbly:0.1.0": numbly
#let font = (main: "IBM Plex Serif", mono: "IBM Plex Mono", cjk: "Noto Serif CJK SC")
#let cjk-markers = regex("[“”‘’.,。、?!:;(){}[]〔〕〖〗《》〈〉「」【】『』─—_·…\u{30FC}]+")
#let fakepar = context {
box()
v(-measure(block() + block()).height)
}
// 标题,(小组成员), (结对小组成员), 日期
#let assign_cover(title, members, pairMembers, date) = {
align(
center,
text(size: 36pt, weight: "bold")[
#v(4em)
软件测试技术实验报告
],
)
align(
left,
text(size: 20pt, weight: "medium")[
#v(2em)
#title
],
)
v(1fr)
align(
center,
grid(
columns: 2,
align(right, text(size: 14pt)[小组成员:#box()]),
align(
left,
(
for member in members {
text(size: 14pt)[
#member.name(学号:#member.id)
]
}
),
),
),
)
linebreak()
if pairMembers == none { } else {
align(
center,
grid(
columns: 2,
align(right, text(size: 14pt)[结对小组成员:#box()]),
align(
left,
(
for member in pairMembers {
text(size: 14pt)[
#member.name(学号:#member.id)
]
}
),
),
),
)
}
linebreak()
align(
center,
text(size: 14pt)[
完成日期:#date.display("[year]年[month padding:none]月[day padding:none]日")
],
)
pagebreak(weak: true)
}
#let assign_outline(title) = {
set page(paper: "a4")
show outline.entry.where(level: 1): it => {
v(14pt, weak: true)
text(size: 14pt)[#it]
}
align(center, text(28pt, weight: "bold")[实验目录])
v(15pt)
outline(title: none, depth: 1, indent: auto)
}
#let assign_class(title, author, members, pairMembers, date, body) = {
set page(paper: "a4", margin: auto)
set text(font: (font.main, font.cjk), lang: "zh", region: "cn")
show cjk-markers: set text(font: font.cjk)
set heading(
numbering: numbly(
"{1:一}、", // use {level:format} to specify the format
"{2:1}.", // if format is not specified, arabic numbers will be used
"({3:1})", // here, we only want the 3rd level
),
)
set document(title: title, author: author)
set par(justify: true)
show math.equation.where(block: true): it => block(width: 100%, align(center, it))
set raw(tab-size: 4)
show raw: set text(font: (font.mono, font.cjk))
// Display inline code in a small box
// that retains the correct baseline.
show raw.where(block: false): box.with(fill: luma(240), inset: (x: 4pt, y: 0pt), outset: (y: 4pt), radius: 4pt)
show raw.where(block: true): it => {
set par(justify: false)
block(
fill: luma(240),
inset: 8pt,
radius: 8pt,
)[
#place(top + right, dy: -4pt, dx: 4pt)[#text(fill: gray, style: "italic", size: 8pt, it.lang)]
#grid(
columns: (auto, 1fr),
align: (x, y) => if x == 0 {right} else {left},
column-gutter: 0.5em,
// stroke: (x,y) => if x==0 {( right: (paint:gray, dash:"densely-dotted") )},
inset: 0.25em,
..it.lines.map((line) => (text(fill:gray, str(line.number)), line.body)).flatten()
)
]
}
show link: it => {
set text(fill: blue)
underline(it)
}
set list(indent: 2em)
set enum(indent: 2em)
set enum(
numbering: numbly(
"{1:1}.",
"{2:a})",
),
full: true,
)
show list: it => {
set list(indent: 0.5em)
set enum(indent: 0.5em)
it
}
show enum: it => {
set enum(indent: 0.5em)
set list(indent: 0.5em)
it
}
assign_cover(title, members, pairMembers, date)
assign_outline(title)
set page(
paper: "a4",
margin: auto,
footer: [
#set align(center)
#set text(9pt)
#context {
counter(page).display("1")
}
],
)
counter(page).update(1)
// align(center, text(size: 21pt, weight: "bold", title))
[
#show heading: it => {
set align(center)
set text(size: 21pt, weight: "bold")
it
}
#heading(numbering: none, depth: 1, title)
]
show heading: set block(spacing: 1.2em)
show heading.where(depth: 1): it => {
show h.where(amount: 0.3em): none
it
}
set text(size: 12pt)
set par(first-line-indent: 2em)
show math.equation.where(block: true): it => it + fakepar // 公式后缩进
show heading: it => it + fakepar // 标题后缩进
show figure: it => it + fakepar // 图表后缩进
show enum: it => it + fakepar
show list: it => it + fakepar // 列表后缩进
show grid: it => it + fakepar // 列表后缩进
show raw.where(block: true): it => it + fakepar
body
}
#let list(body) = {
let fakepar = context {
box()
v(-measure(block() + block()).height)
}
grid(columns: (2em, 1fr))[][
#body
]
fakepar
}
// 实验名称,实验编号,开发者,模块名称,用例作者,参考信息,测试类型,设计日期,测试方法,测试日期,测试对象,前置条件
#let test_case_table(
title: none,
id: none,
developer: none,
module_name: none,
use_case_author: none,
reference: none,
test_type: none,
design_date: none,
test_method: none,
test_date: none,
test_object: none,
precondition: none,
columns_width: (1.2fr, 1.2fr, 1.2fr, 1.4fr),
is_operation: none,
..body,
) = (
context {
set text(size: 10.5pt)
set table(
align: center + horizon,
// rows: 2em,
inset: 6pt,
)
show figure: set block(breakable: true)
figure(
[
#block(breakable: false)[
#set text(number-width: "proportional")
#show table.cell: it => {
if it.x == 0 or it.x == 2 {
strong(it)
} else {
it
}
}
#table(
columns: (7em, 2fr, 7em, 2fr),
[实验名称], [#title], [实验编号], [#id],
[开发人员], [#developer], [模块名称], [#module_name],
[用例作者], [#use_case_author], [参考信息], [#reference],
[测试类型], [#test_type], [设计日期], [#design_date.display("[year]年[month]月[day]日")],
[测试方法], [#test_method], [测试日期], [#test_date.display("[year]年[month]月[day]日")],
[测试对象], table.cell(colspan: 3)[#test_object],
[前置条件], table.cell(colspan: 3)[#precondition],
)]
#v(0em, weak: true)
#[
#set text(number-width: "proportional", spacing: 150%)
#show table.cell: it => {
if it.y == 0 {
strong(it)
} else {
it
}
}
#table(
columns: (7em, ..columns_width),
[用例编号], [
#if is_operation == true {
"操作"
} else {
"输入数据"
}
], [预期结果], [实际结果], [备注],
..body,
)]
],
caption: test_method + "测试用例表",
)
}
)