1 /*
2  * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
3  *
4  * This library is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #include "evolution-config.h"
18 
19 #include <e-util/e-util.h>
20 
21 #include "test-html-editor-units-utils.h"
22 
23 #include "test-html-editor-units-bugs.h"
24 
25 static void
test_bug_750657(TestFixture * fixture)26 test_bug_750657 (TestFixture *fixture)
27 {
28 	if (!test_utils_process_commands (fixture,
29 		"mode:html\n")) {
30 		g_test_fail ();
31 		return;
32 	}
33 
34 	test_utils_insert_content (fixture,
35 		"<html><head></head><body>"
36 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">\n"
37 		"<div>This is the first paragraph of a quoted text which has some long text to test. It has the second sentence as well.</div>\n"
38 		"<div><br></div>\n"
39 		"<div>This is the third paragraph of a quoted text which has some long text to test. It has the second sentence as well.</div>\n"
40 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">\n"
41 		"<div>This is the first paragraph of a sub-quoted text which has some long text to test. It has the second sentence as well.</div>\n"
42 		"<br>\n"
43 		"</blockquote>\n"
44 		"<div>This is the fourth paragraph of a quoted text which has some long text to test. It has the second sentence as well.</div>\n"
45 		"</blockquote>\n"
46 		"<div><br></div>"
47 		"</body></html>",
48 		E_CONTENT_EDITOR_INSERT_TEXT_HTML | E_CONTENT_EDITOR_INSERT_REPLACE_ALL);
49 
50 	if (!test_utils_run_simple_test (fixture,
51 		"seq:CecuuuSuusD\n",
52 		HTML_PREFIX
53 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
54 		"<div>This is the first paragraph of a quoted text which has some long text to test. It has the second sentence as well.</div>"
55 		"<div><br></div>"
56 		"<div>This is the third paragraph of a quoted text which has some long text to test. It has the second sentence as well.</div>"
57 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
58 		"<div><br></div>"
59 		"</blockquote>"
60 		"<div>This is the fourth paragraph of a quoted text which has some long text to test. It has the second sentence as well.</div>"
61 		"</blockquote>"
62 		"<div><br></div>"
63 		HTML_SUFFIX,
64 		NULL)) {
65 		g_test_fail ();
66 		return;
67 	}
68 }
69 
70 static void
test_bug_760989(TestFixture * fixture)71 test_bug_760989 (TestFixture *fixture)
72 {
73 	if (!test_utils_process_commands (fixture,
74 		"mode:html\n"
75 		"type:a\n")) {
76 		g_test_fail ();
77 		return;
78 	}
79 
80 	test_utils_insert_content (fixture,
81 		"<html><head></head><body>\n"
82 		"One line before quotation<br>\n"
83 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">\n"
84 		"<div>Single line quoted.</div>\n"
85 		"</blockquote>\n"
86 		"</body></html>",
87 		E_CONTENT_EDITOR_INSERT_TEXT_HTML);
88 
89 	if (!test_utils_run_simple_test (fixture,
90 		"seq:ChcD\n",
91 		HTML_PREFIX "<div>One line before quotation</div>\n"
92 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">\n"
93 		"<div>Single line quoted.</div>\n"
94 		"</blockquote>" HTML_SUFFIX,
95 		"One line before quotation\n"
96 		"> Single line quoted.\n")) {
97 		g_test_fail ();
98 		return;
99 	}
100 
101 	if (!test_utils_run_simple_test (fixture,
102 		"seq:Cecb\n",
103 		HTML_PREFIX "<div>One line before quotation</div>\n"
104 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">\n"
105 		"<div>Single line quoted</div>\n"
106 		"</blockquote>" HTML_SUFFIX,
107 		"One line before quotation\n"
108 		"> Single line quoted\n")) {
109 		g_test_fail ();
110 		return;
111 	}
112 }
113 
114 static void
test_bug_767903(TestFixture * fixture)115 test_bug_767903 (TestFixture *fixture)
116 {
117 	if (!test_utils_run_simple_test (fixture,
118 		"mode:plain\n"
119 		"type:This is the first line:\\n\n"
120 		"action:style-list-bullet\n"
121 		"type:First item\\n\n"
122 		"type:Second item\n",
123 		HTML_PREFIX "<div style=\"width: 71ch;\">This is the first line:</div>"
124 		"<ul style=\"width: 68ch;\">"
125 		"<li>First item</li><li>Second item</li></ul>" HTML_SUFFIX,
126 		"This is the first line:\n"
127 		" * First item\n"
128 		" * Second item\n")) {
129 		g_test_fail ();
130 		return;
131 	}
132 
133 	if (!test_utils_run_simple_test (fixture,
134 		"seq:uhb\n"
135 		"undo:undo\n",
136 		HTML_PREFIX "<div style=\"width: 71ch;\">This is the first line:</div>"
137 		"<ul style=\"width: 68ch;\">"
138 		"<li>First item</li><li>Second item</li></ul>" HTML_SUFFIX,
139 		"This is the first line:\n"
140 		" * First item\n"
141 		" * Second item\n")) {
142 		g_test_fail ();
143 		return;
144 	}
145 }
146 
147 static void
test_bug_769708(TestFixture * fixture)148 test_bug_769708 (TestFixture *fixture)
149 {
150 	if (!test_utils_process_commands (fixture,
151 		"mode:plain\n")) {
152 		g_test_fail ();
153 		return;
154 	}
155 
156 	test_utils_insert_content (fixture,
157 		"<html><head><style id=\"-x-evo-quote-style\" type=\"text/css\">.-x-evo-quoted { -webkit-user-select: none; }</style>"
158 		"<style id=\"-x-evo-style-a\" type=\"text/css\">a { cursor: text; }</style></head>"
159 		"<body data-evo-draft=\"\" data-evo-plain-text=\"\" spellcheck=\"true\">"
160 		"<div data-evo-paragraph=\"\" id=\"-x-evo-input-start\">aaa</div>"
161 		"<div class=\"-x-evo-signature-wrapper\"><span class=\"-x-evo-signature\" id=\"autogenerated\"><pre>-- <br></pre>"
162 		"<div data-evo-paragraph=\"\">user &lt;user@no.where&gt;</div>"
163 		"</span></div></body></html>",
164 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
165 
166 	if (!test_utils_run_simple_test (fixture,
167 		"",
168 		HTML_PREFIX "<div style=\"width: 71ch;\">aaa</div>"
169 		"<div style=\"width: 71ch;\"><span><pre>-- <br></pre>"
170 		"<div>user &lt;<a href=\"mailto:user@no.where\">user@no.where</a>&gt;</div>"
171 		"</span></div>" HTML_SUFFIX,
172 		"aaa\n"
173 		"-- \n"
174 		"user <user@no.where>\n"))
175 		g_test_fail ();
176 }
177 
178 static void
test_bug_769913(TestFixture * fixture)179 test_bug_769913 (TestFixture *fixture)
180 {
181 	if (!test_utils_process_commands (fixture,
182 		"mode:html\n")) {
183 		g_test_fail ();
184 		return;
185 	}
186 
187 	if (!test_utils_run_simple_test (fixture,
188 		"type:ab\n"
189 		"seq:ltlD\n",
190 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
191 		"ab\n")) {
192 		g_test_fail ();
193 		return;
194 	}
195 
196 	if (!test_utils_run_simple_test (fixture,
197 		"seq:ttllDD\n",
198 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
199 		"ab\n")) {
200 		g_test_fail ();
201 		return;
202 	}
203 
204 	if (!test_utils_run_simple_test (fixture,
205 		"seq:ttlDlD\n",
206 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
207 		"ab\n")) {
208 		g_test_fail ();
209 		return;
210 	}
211 
212 	if (!test_utils_run_simple_test (fixture,
213 		"seq:tttlllDDD\n",
214 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
215 		"ab\n")) {
216 		g_test_fail ();
217 		return;
218 	}
219 
220 	if (!test_utils_run_simple_test (fixture,
221 		"seq:tttlDlDlD\n",
222 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
223 		"ab\n")) {
224 		g_test_fail ();
225 		return;
226 	}
227 
228 	if (!test_utils_run_simple_test (fixture,
229 		"seq:tb\n",
230 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
231 		"ab\n")) {
232 		g_test_fail ();
233 		return;
234 	}
235 
236 	if (!test_utils_run_simple_test (fixture,
237 		"seq:ttbb\n",
238 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
239 		"ab\n")) {
240 		g_test_fail ();
241 		return;
242 	}
243 
244 	if (!test_utils_run_simple_test (fixture,
245 		"seq:ttlbrb\n",
246 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
247 		"ab\n")) {
248 		g_test_fail ();
249 		return;
250 	}
251 
252 	if (!test_utils_run_simple_test (fixture,
253 		"seq:tttbbb\n",
254 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
255 		"ab\n")) {
256 		g_test_fail ();
257 		return;
258 	}
259 
260 	if (!test_utils_run_simple_test (fixture,
261 		"seq:tttllbrbrb\n",
262 		HTML_PREFIX "<div>ab</div>" HTML_SUFFIX,
263 		"ab\n")) {
264 		g_test_fail ();
265 		return;
266 	}
267 }
268 
269 static void
test_bug_769955(TestFixture * fixture)270 test_bug_769955 (TestFixture *fixture)
271 {
272 	test_utils_set_clipboard_text ("http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines", FALSE);
273 
274 	/* Use paste action, pretty the same as Ctrl+V */
275 
276 	if (!test_utils_run_simple_test (fixture,
277 		"mode:plain\n"
278 		"action:paste\n"
279 		"seq:ll\n"
280 		"action:style-preformat\n",
281 		HTML_PREFIX "<pre>"
282 		"<a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
283 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>"
284 		HTML_SUFFIX,
285 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
286 		g_test_fail ();
287 		return;
288 	}
289 
290 	if (!test_utils_run_simple_test (fixture,
291 		"seq:C\n"
292 		"type:a\n"
293 		"action:style-normal\n"
294 		"seq:Dc\n"
295 		"type:[1] \n"
296 		"action:paste\n"
297 		"action:style-preformat\n",
298 		HTML_PREFIX "<pre>"
299 		"[1] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
300 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
301 		"[1] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
302 		g_test_fail ();
303 		return;
304 	}
305 
306 	if (!test_utils_run_simple_test (fixture,
307 		"seq:C\n"
308 		"type:a\n"
309 		"action:style-normal\n"
310 		"seq:Dc\n"
311 		"type:[2] \n"
312 		"action:paste\n"
313 		"seq:h\n"
314 		"action:style-preformat\n",
315 		HTML_PREFIX "<pre>"
316 		"[2] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
317 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
318 		"[2] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
319 		g_test_fail ();
320 		return;
321 	}
322 
323 	if (!test_utils_run_simple_test (fixture,
324 		"seq:C\n"
325 		"type:a\n"
326 		"action:style-normal\n"
327 		"seq:Dc\n"
328 		"type:[3] \n"
329 		"action:paste\n"
330 		"seq:Chc\n"
331 		"action:style-preformat\n",
332 		HTML_PREFIX "<pre>"
333 		"[3] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
334 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
335 		"[3] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
336 		g_test_fail ();
337 		return;
338 	}
339 
340 	if (!test_utils_run_simple_test (fixture,
341 		"seq:C\n"
342 		"type:a\n"
343 		"action:style-normal\n"
344 		"seq:Dc\n"
345 		"type:[4] \n"
346 		"action:paste\n"
347 		"seq:l\n"
348 		"action:style-preformat\n",
349 		HTML_PREFIX "<pre>"
350 		"[4] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
351 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
352 		"[4] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
353 		g_test_fail ();
354 		return;
355 	}
356 
357 	/* Use Shift+Insert instead of paste action */
358 
359 	if (!test_utils_run_simple_test (fixture,
360 		"seq:C\n"
361 		"type:a\n"
362 		"action:style-normal\n"
363 		"seq:Dc\n"
364 		"seq:Sis\n"
365 		"seq:ll\n"
366 		"action:style-preformat\n",
367 		HTML_PREFIX "<pre>"
368 		"<a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
369 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>"
370 		HTML_SUFFIX,
371 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
372 		g_test_fail ();
373 		return;
374 	}
375 
376 	if (!test_utils_run_simple_test (fixture,
377 		"seq:C\n"
378 		"type:a\n"
379 		"action:style-normal\n"
380 		"seq:Dc\n"
381 		"type:[5] \n"
382 		"seq:Sis\n"
383 		"action:style-preformat\n",
384 		HTML_PREFIX "<pre>"
385 		"[5] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
386 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
387 		"[5] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
388 		g_test_fail ();
389 		return;
390 	}
391 
392 	if (!test_utils_run_simple_test (fixture,
393 		"seq:C\n"
394 		"type:a\n"
395 		"action:style-normal\n"
396 		"seq:Dc\n"
397 		"type:[6] \n"
398 		"seq:Sis\n"
399 		"seq:h\n"
400 		"action:style-preformat\n",
401 		HTML_PREFIX "<pre>"
402 		"[6] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
403 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
404 		"[6] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
405 		g_test_fail ();
406 		return;
407 	}
408 
409 	if (!test_utils_run_simple_test (fixture,
410 		"seq:C\n"
411 		"type:a\n"
412 		"action:style-normal\n"
413 		"seq:Dc\n"
414 		"type:[7] \n"
415 		"seq:Sis\n"
416 		"seq:Chc\n"
417 		"action:style-preformat\n",
418 		HTML_PREFIX "<pre>"
419 		"[7] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
420 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
421 		"[7] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
422 		g_test_fail ();
423 		return;
424 	}
425 
426 	if (!test_utils_run_simple_test (fixture,
427 		"seq:C\n"
428 		"type:a\n"
429 		"action:style-normal\n"
430 		"seq:Dc\n"
431 		"type:[8] \n"
432 		"seq:Sis\n"
433 		"seq:l\n"
434 		"action:style-preformat\n",
435 		HTML_PREFIX "<pre>"
436 		"[8] <a href=\"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\">"
437 		"http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines</a></pre>" HTML_SUFFIX,
438 		"[8] http://www.example.com/this-is-a-very-long-link-which-should-not-be-wrapped-into-multiple-lines\n")) {
439 		g_test_fail ();
440 		return;
441 	}
442 }
443 
444 static void
test_bug_770073(TestFixture * fixture)445 test_bug_770073 (TestFixture *fixture)
446 {
447 	if (!test_utils_process_commands (fixture,
448 		"mode:plain\n")) {
449 		g_test_fail ();
450 		return;
451 	}
452 
453 	test_utils_insert_content (fixture,
454 		"<!-- text/html -->"
455 		"<div><span>the 1st line text</span></div>"
456 		"<br>"
457 		"<div><span>the 3rd line text</span></div>"
458 		"<span class=\"-x-evo-to-body\" data-credits=\"On Today, User wrote:\"></span><span class=\"-x-evo-cite-body\"></span>",
459 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
460 
461 	if (!test_utils_run_simple_test (fixture,
462 		"seq:Chcddb\n",
463 		HTML_PREFIX "<div style=\"width: 71ch;\">On Today, User wrote:</div>"
464 		"<blockquote type=\"cite\">"
465 		"<div>" QUOTE_SPAN (QUOTE_CHR) "the 1st line text</div>"
466 		"<div>" QUOTE_SPAN (QUOTE_CHR) "the 3rd line text</div>"
467 		"</blockquote>" HTML_SUFFIX,
468 		"On Today, User wrote:\n"
469 		"> the 1st line text\n"
470 		"> the 3rd line text\n")) {
471 		g_test_fail ();
472 		return;
473 	}
474 
475 	if (!test_utils_process_commands (fixture,
476 		"mode:html\n")) {
477 		g_test_fail ();
478 		return;
479 	}
480 
481 	test_utils_insert_content (fixture,
482 		"<!-- text/html -->"
483 		"<div><span>the first line text</span></div>"
484 		"<br>"
485 		"<div><span>the third line text</span></div>"
486 		"<span class=\"-x-evo-to-body\" data-credits=\"On Today, User wrote:\"></span><span class=\"-x-evo-cite-body\"></span>",
487 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
488 
489 	if (!test_utils_run_simple_test (fixture,
490 		"seq:Chcddb\n",
491 		HTML_PREFIX "<div>On Today, User wrote:</div>"
492 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
493 		"<div><span>the first line text</span></div>"
494 		"<div><span>the third line text</span></div>"
495 		"</blockquote>" HTML_SUFFIX,
496 		"On Today, User wrote:\n"
497 		"> the first line text\n"
498 		"> the third line text\n"))
499 		g_test_fail ();
500 
501 }
502 
503 static void
test_bug_770074(TestFixture * fixture)504 test_bug_770074 (TestFixture *fixture)
505 {
506 	if (!test_utils_process_commands (fixture,
507 		"mode:plain\n")) {
508 		g_test_fail ();
509 		return;
510 	}
511 
512 	test_utils_insert_content (fixture,
513 		"<!-- text/html -->"
514 		"<div><span>the 1st line text</span></div>"
515 		"<br>"
516 		"<div><span>the 3rd line text</span></div>"
517 		"<span class=\"-x-evo-to-body\" data-credits=\"On Today, User wrote:\"></span><span class=\"-x-evo-cite-body\"></span>",
518 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
519 
520 	if (!test_utils_run_simple_test (fixture,
521 		"seq:Chcddb\n"
522 		"seq:n\n"
523 		"undo:undo\n",
524 		HTML_PREFIX "<div style=\"width: 71ch;\">On Today, User wrote:</div>"
525 		"<blockquote type=\"cite\">"
526 		"<div>" QUOTE_SPAN (QUOTE_CHR) "the 1st line text</div>"
527 		"<div>" QUOTE_SPAN (QUOTE_CHR) "the 3rd line text</div>"
528 		"</blockquote>" HTML_SUFFIX,
529 		"On Today, User wrote:\n"
530 		"> the 1st line text\n"
531 		"> the 3rd line text\n"))
532 		g_test_fail ();
533 }
534 
535 static void
test_bug_771044(TestFixture * fixture)536 test_bug_771044 (TestFixture *fixture)
537 {
538 	if (!test_utils_run_simple_test (fixture,
539 		"type:123 456\\n789 abc\\n\n"
540 		"seq:uuhSdsD\n",
541 		HTML_PREFIX
542 		"<div>789 abc</div>"
543 		"<div><br></div>"
544 		HTML_SUFFIX,
545 		"789 abc\n\n"))
546 		g_test_fail ();
547 }
548 
549 static void
test_bug_771131(TestFixture * fixture)550 test_bug_771131 (TestFixture *fixture)
551 {
552 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", TRUE);
553 
554 	if (!test_utils_process_commands (fixture,
555 		"mode:plain\n")) {
556 		g_test_fail ();
557 		return;
558 	}
559 
560 	test_utils_insert_content (fixture,
561 		"<body><pre>On &lt;date1&gt;, &lt;name1&gt; wrote:\n"
562 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
563 		"Hello\n"
564 		"\n"
565 		"Goodbye</blockquote>"
566 		"<div><span>the 3rd line text</span></div>"
567 		"</pre><span class=\"-x-evo-to-body\" data-credits=\"On Sat, 2016-09-10 at 20:00 +0000, example@example.com wrote:\"></span>"
568 		"<span class=\"-x-evo-cite-body\"></span></body>",
569 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
570 
571 	if (!test_utils_run_simple_test (fixture,
572 		"",
573 		HTML_PREFIX "<div style=\"width: 71ch;\">On Sat, 2016-09-10 at 20:00 +0000, <a href=\"mailto:example@example.com\">example@example.com</a> wrote:</div>"
574 		"<blockquote type=\"cite\">"
575 		"<div>" QUOTE_SPAN (QUOTE_CHR) "On &lt;date1&gt;, &lt;name1&gt; wrote:</div>"
576 		"<blockquote type=\"cite\">"
577 		"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "Hello</div>"
578 		"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "<br></div>"
579 		"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "Goodbye</div>"
580 		"</blockquote>"
581 		"<div>" QUOTE_SPAN (QUOTE_CHR) "the 3rd line text</div>"
582 		"</blockquote>"
583 		HTML_SUFFIX,
584 		"On Sat, 2016-09-10 at 20:00 +0000, example@example.com wrote:\n"
585 		"> On <date1>, <name1> wrote:\n"
586 		"> > Hello\n"
587 		"> > \n"
588 		"> > Goodbye\n"
589 		"> the 3rd line text\n"))
590 		g_test_fail ();
591 
592 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", FALSE);
593 
594 	test_utils_insert_content (fixture,
595 		"<body><pre>On &lt;date1&gt;, &lt;name1&gt; wrote:\n"
596 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
597 		"Hello\n"
598 		"\n"
599 		"Goodbye</blockquote>"
600 		"<div><span>the 3rd line text</span></div>"
601 		"</pre><span class=\"-x-evo-to-body\" data-credits=\"On Sat, 2016-09-10 at 20:00 +0000, example@example.com wrote:\"></span>"
602 		"<span class=\"-x-evo-cite-body\"></span></body>",
603 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
604 
605 	if (!test_utils_run_simple_test (fixture,
606 		"",
607 		HTML_PREFIX "<div style=\"width: 71ch;\">On Sat, 2016-09-10 at 20:00 +0000, <a href=\"mailto:example@example.com\">example@example.com</a> wrote:</div>"
608 		"<blockquote type=\"cite\">"
609 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "On &lt;date1&gt;, &lt;name1&gt; wrote:</pre>"
610 		"<blockquote type=\"cite\">"
611 		"<pre>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "Hello</pre>"
612 		"<pre>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "<br></pre>"
613 		"<pre>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "Goodbye</pre>"
614 		"</blockquote>"
615 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "the 3rd line text</pre>"
616 		"</blockquote>"
617 		HTML_SUFFIX,
618 		"On Sat, 2016-09-10 at 20:00 +0000, example@example.com wrote:\n"
619 		"> On <date1>, <name1> wrote:\n"
620 		"> > Hello\n"
621 		"> > \n"
622 		"> > Goodbye\n"
623 		"> the 3rd line text\n"))
624 		g_test_fail ();
625 }
626 
627 static void
test_bug_771493(TestFixture * fixture)628 test_bug_771493 (TestFixture *fixture)
629 {
630 	if (!test_utils_process_commands (fixture,
631 		"mode:plain\n")) {
632 		g_test_fail ();
633 		return;
634 	}
635 
636 	test_utils_insert_content (fixture,
637 		"<body><pre><br>"
638 		"----- Original Message -----\n"
639 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
640 		"This week summary:"
641 		"</blockquote>"
642 		"</pre><span class=\"-x-evo-to-body\" data-credits=\"On Thu, 2016-09-15 at 08:08 -0400, user wrote:\"></span>"
643 		"<span class=\"-x-evo-cite-body\"></span></body>",
644 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
645 
646 	if (!test_utils_run_simple_test (fixture,
647 		"",
648 		HTML_PREFIX "<div style=\"width: 71ch;\">On Thu, 2016-09-15 at 08:08 -0400, user wrote:</div>"
649 		"<blockquote type=\"cite\">"
650 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
651 		"<div>" QUOTE_SPAN (QUOTE_CHR) "----- Original Message -----</div>"
652 		"<blockquote type=\"cite\">"
653 		"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "This week summary:</div>"
654 		"</blockquote>"
655 		"</blockquote>"
656 		HTML_SUFFIX,
657 		"On Thu, 2016-09-15 at 08:08 -0400, user wrote:\n"
658 		"> \n"
659 		"> ----- Original Message -----\n"
660 		"> > This week summary:\n"))
661 		g_test_fail ();
662 }
663 
664 static void
test_bug_772171(TestFixture * fixture)665 test_bug_772171 (TestFixture *fixture)
666 {
667 	if (!test_utils_process_commands (fixture,
668 		"mode:plain\n")) {
669 		g_test_fail ();
670 		return;
671 	}
672 
673 	test_utils_insert_content (fixture,
674 		"<body><pre>a\n"
675 		"b\n"
676 		"</pre>"
677 		"<span class=\"-x-evo-to-body\" data-credits=\"On Thu, 2016-09-15 at 08:08 -0400, user wrote:\"></span>"
678 		"<span class=\"-x-evo-cite-body\"></span></body>",
679 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
680 
681 	if (!test_utils_run_simple_test (fixture,
682 		"seq:deb",
683 		HTML_PREFIX "<div style=\"width: 71ch;\">On Thu, 2016-09-15 at 08:08 -0400, user wrote:</div>"
684 		"<blockquote type=\"cite\">"
685 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
686 		"<div>" QUOTE_SPAN (QUOTE_CHR) "b</div>"
687 		"</blockquote>"
688 		HTML_SUFFIX,
689 		"On Thu, 2016-09-15 at 08:08 -0400, user wrote:\n"
690 		"> \n"
691 		"> b\n"))
692 		g_test_fail ();
693 }
694 
695 static void
test_bug_772513(TestFixture * fixture)696 test_bug_772513 (TestFixture *fixture)
697 {
698 	EContentEditor *cnt_editor;
699 	gboolean set_signature_from_message, check_if_signature_is_changed, ignore_next_signature_change;
700 
701 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-reply-start-bottom", TRUE);
702 
703 	if (!test_utils_process_commands (fixture,
704 		"mode:plain\n")) {
705 		g_test_fail ();
706 		return;
707 	}
708 
709 	cnt_editor = test_utils_get_content_editor (fixture);
710 
711 	e_content_editor_insert_signature (
712 		cnt_editor,
713 		"",
714 		FALSE,
715 		FALSE,
716 		"none",
717 		&set_signature_from_message,
718 		&check_if_signature_is_changed,
719 		&ignore_next_signature_change);
720 
721 	if (!test_utils_run_simple_test (fixture,
722 		"",
723 		HTML_PREFIX "<div style=\"width: 71ch;\"><br></div>"
724 		"<div style=\"width: 71ch;\"><span></span></div>" HTML_SUFFIX,
725 		"\n"))
726 		g_test_fail ();
727 }
728 
729 static void
test_bug_772918(TestFixture * fixture)730 test_bug_772918 (TestFixture *fixture)
731 {
732 	if (!test_utils_run_simple_test (fixture,
733 		"mode:html\n"
734 		"type:a b c d\n"
735 		"seq:lll\n"
736 		"type:1 2 3 \n"
737 		"undo:undo:6\n"
738 		"undo:redo:6\n",
739 		HTML_PREFIX "<div>a b 1 2 3 c d</div>" HTML_SUFFIX,
740 		"a b 1 2 3 c d\n"))
741 		g_test_fail ();
742 }
743 
744 static void
test_bug_773164(TestFixture * fixture)745 test_bug_773164 (TestFixture *fixture)
746 {
747 	test_utils_set_clipboard_text ("This is paragraph 1\n\nThis is paragraph 2\n\nThis is a longer paragraph 3", FALSE);
748 
749 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-paste-plain-prefer-pre", TRUE);
750 
751 	if (!test_utils_run_simple_test (fixture,
752 		"mode:plain\n"
753 		"undo:save\n"
754 		"action:paste\n"
755 		"undo:undo\n"
756 		"undo:test\n"
757 		"undo:redo\n"
758 		"seq:huuue\n" /* Go to the end of the second line */
759 		"seq:Sddes\n"
760 		"action:cut\n"
761 		"seq:dde\n" /* Go to the end of the last line */
762 		"action:paste\n"
763 		"undo:undo:3\n"
764 		"undo:test\n"
765 		"undo:redo:3\n",
766 		HTML_PREFIX "<pre>This is paragraph 1</pre>"
767 		"<pre><br></pre>"
768 		"<pre>This is a longer paragraph 3</pre>"
769 		"<pre><br></pre>"
770 		"<pre>This is paragraph 2</pre>"
771 		"<pre><br></pre>"
772 		HTML_SUFFIX,
773 		"This is paragraph 1\n"
774 		"\n"
775 		"This is a longer paragraph 3\n"
776 		"\n"
777 		"This is paragraph 2\n"
778 		"\n"))
779 		g_test_fail ();
780 }
781 
782 static void
test_bug_775042(TestFixture * fixture)783 test_bug_775042 (TestFixture *fixture)
784 {
785 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", FALSE);
786 
787 	test_utils_insert_content (fixture,
788 		"<body><pre>a\n"
789 		"b\n"
790 		"c"
791 		"<span class=\"-x-evo-to-body\" data-credits=\"On Fri, 2016-11-25 at 08:18 +0000, user wrote:\"></span>"
792 		"<span class=\"-x-evo-cite-body\"></span></body>",
793 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
794 
795 	if (!test_utils_run_simple_test (fixture,
796 		"seq:rl\n"
797 		"mode:plain\n",
798 		HTML_PREFIX "<div style=\"width: 71ch;\">On Fri, 2016-11-25 at 08:18 +0000, user wrote:</div>"
799 		"<blockquote type=\"cite\">"
800 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "a</pre>"
801 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "b</pre>"
802 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "c</pre>"
803 		"</blockquote>"
804 		HTML_SUFFIX,
805 		"On Fri, 2016-11-25 at 08:18 +0000, user wrote:\n"
806 		"> a\n"
807 		"> b\n"
808 		"> c\n")) {
809 		g_test_fail ();
810 		return;
811 	}
812 
813 	test_utils_insert_content (fixture,
814 		"<body><pre>a\n"
815 		"b\n"
816 		"c"
817 		"<span class=\"-x-evo-to-body\" data-credits=\"On Fri, 2016-11-25 at 08:18 +0000, user wrote:\"></span>"
818 		"<span class=\"-x-evo-cite-body\"></span></body>",
819 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
820 
821 	if (!test_utils_run_simple_test (fixture,
822 		"seq:rl\n",
823 		HTML_PREFIX "<div style=\"width: 71ch;\">On Fri, 2016-11-25 at 08:18 +0000, user wrote:</div>"
824 		"<blockquote type=\"cite\">"
825 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "a</pre>"
826 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "b</pre>"
827 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "c</pre>"
828 		"</blockquote>"
829 		HTML_SUFFIX,
830 		"On Fri, 2016-11-25 at 08:18 +0000, user wrote:\n"
831 		"> a\n"
832 		"> b\n"
833 		"> c\n")) {
834 		g_test_fail ();
835 		return;
836 	}
837 
838 	test_utils_insert_content (fixture,
839 		"<body><div>a</div>"
840 		"<p>b</p>"
841 		"<div>c</div>"
842 		"<span class=\"-x-evo-to-body\" data-credits=\"On Fri, 2016-11-25 at 08:18 +0000, user wrote:\"></span>"
843 		"<span class=\"-x-evo-cite-body\"></span></body>",
844 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
845 
846 	if (!test_utils_run_simple_test (fixture,
847 		"seq:rl\n",
848 		HTML_PREFIX "<div style=\"width: 71ch;\">On Fri, 2016-11-25 at 08:18 +0000, user wrote:</div>"
849 		"<blockquote type=\"cite\">"
850 		"<div>" QUOTE_SPAN (QUOTE_CHR) "a</div>"
851 		"<div>" QUOTE_SPAN (QUOTE_CHR) "b</div>"
852 		"<div>" QUOTE_SPAN (QUOTE_CHR) "c</div>"
853 		"</blockquote>"
854 		HTML_SUFFIX,
855 		"On Fri, 2016-11-25 at 08:18 +0000, user wrote:\n"
856 		"> a\n"
857 		"> b\n"
858 		"> c\n")) {
859 		g_test_fail ();
860 		return;
861 	}
862 }
863 
864 static void
test_bug_775691(TestFixture * fixture)865 test_bug_775691 (TestFixture *fixture)
866 {
867 	if (!test_utils_run_simple_test (fixture,
868 		"mode:plain\n"
869 		"type:abc def ghi\\n\n"
870 		"seq:urrrrSrrrs\n"
871 		"action:copy\n"
872 		"seq:d\n"
873 		"action:paste\n",
874 		HTML_PREFIX "<div style=\"width: 71ch;\">abc def ghi</div>"
875 		"<div style=\"width: 71ch;\">def</div>"
876 		HTML_SUFFIX,
877 		"abc def ghi\n"
878 		"def\n"))
879 		g_test_fail ();
880 }
881 
882 static void
test_bug_779707(TestFixture * fixture)883 test_bug_779707 (TestFixture *fixture)
884 {
885 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-reply-start-bottom", TRUE);
886 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", FALSE);
887 
888 	if (!test_utils_process_commands (fixture,
889 		"mode:plain\n")) {
890 		g_test_fail ();
891 		return;
892 	}
893 
894 	test_utils_insert_content (fixture,
895 		"<pre>line 1\n"
896 		"line 2\n"
897 		"line 3\n"
898 		"</pre><span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
899 		"<span class=\"-x-evo-cite-body\"></span>",
900 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
901 
902 	if (!test_utils_run_simple_test (fixture,
903 		"seq:ChcddhSesDbnn\n"
904 		"type:a very long text, which splits into multiple lines when this paragraph is not marked as preformatted, but as normal, as it should be\n"
905 		"seq:n\n",
906 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
907 		"<blockquote type=\"cite\">"
908 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "line 1</pre>"
909 		"</blockquote>"
910 		"<div style=\"width: 71ch;\"><br></div>"
911 		"<div style=\"width: 71ch;\">a very long text, which splits into multiple lines when this paragraph is not marked as preformatted, but as normal, as it should be</div>"
912 		"<div style=\"width: 71ch;\"><br></div>"
913 		"<blockquote type=\"cite\">"
914 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "line 3</pre>"
915 		"</blockquote>"
916 		HTML_SUFFIX,
917 		"Credits:\n"
918 		"> line 1\n"
919 		"\n"
920 		"a very long text, which splits into multiple lines when this paragraph\n"
921 		"is not marked as preformatted, but as normal, as it should be\n"
922 		"\n"
923 		"> line 3\n")) {
924 		g_test_fail ();
925 		return;
926 	}
927 
928 	test_utils_insert_content (fixture,
929 		"<div>line 1</div>"
930 		"<div>line 2</div>"
931 		"<div>line 3</div>"
932 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
933 		"<span class=\"-x-evo-cite-body\"></span>",
934 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
935 
936 	if (!test_utils_run_simple_test (fixture,
937 		"seq:ChcddhSesDbnn\n"
938 		"type:a very long text, which splits into multiple lines when this paragraph is not marked as preformatted, but as normal, as it should be\n"
939 		"seq:n\n",
940 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
941 		"<blockquote type=\"cite\">"
942 		"<div>" QUOTE_SPAN (QUOTE_CHR) "line 1</div>"
943 		"</blockquote>"
944 		"<div style=\"width: 71ch;\"><br></div>"
945 		"<div style=\"width: 71ch;\">a very long text, which splits into multiple lines when this paragraph is not marked as preformatted, but as normal, as it should be</div>"
946 		"<div style=\"width: 71ch;\"><br></div>"
947 		"<blockquote type=\"cite\">"
948 		"<div>" QUOTE_SPAN (QUOTE_CHR) "line 3</div>"
949 		"</blockquote>"
950 		HTML_SUFFIX,
951 		"Credits:\n"
952 		"> line 1\n"
953 		"\n"
954 		"a very long text, which splits into multiple lines when this paragraph\n"
955 		"is not marked as preformatted, but as normal, as it should be\n"
956 		"\n"
957 		"> line 3\n"))
958 		g_test_fail ();
959 }
960 
961 static void
test_bug_780275_html(TestFixture * fixture)962 test_bug_780275_html (TestFixture *fixture)
963 {
964 	test_utils_set_clipboard_text ("line 1\nline 2\nline 3", FALSE);
965 
966 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-paste-plain-prefer-pre", TRUE);
967 
968 	if (!test_utils_run_simple_test (fixture,
969 		"mode:html\n"
970 		"type:line 0\n"
971 		"seq:nn\n"
972 		"action:paste-quote\n"
973 		"undo:save\n" /* 1 */
974 		"seq:huuuD\n"
975 		"undo:undo\n"
976 		"undo:test:1\n"
977 		"undo:redo\n"
978 		"type:X\n"
979 		"seq:ddenn\n"
980 		"type:line 4\n"
981 		"undo:drop\n"
982 		"undo:save\n" /* 1 */
983 		"seq:hSuusD\n"
984 		"undo:undo\n"
985 		"undo:test:1\n"
986 		"undo:redo\n",
987 		HTML_PREFIX "<div>line 0</div>"
988 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
989 		"<pre>Xline 1</pre>"
990 		"<pre>line 2</pre>"
991 		"</blockquote>"
992 		"<div>line 4</div>"
993 		HTML_SUFFIX,
994 		"line 0\n"
995 		"> Xline 1\n"
996 		"> line 2\n"
997 		"line 4\n"))
998 		g_test_fail ();
999 }
1000 
1001 static void
test_bug_780275_plain(TestFixture * fixture)1002 test_bug_780275_plain (TestFixture *fixture)
1003 {
1004 	test_utils_set_clipboard_text ("line 1\nline 2\nline 3", FALSE);
1005 
1006 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-paste-plain-prefer-pre", TRUE);
1007 
1008 	if (!test_utils_run_simple_test (fixture,
1009 		"mode:plain\n"
1010 		"type:line 0\n"
1011 		"seq:nn\n"
1012 		"action:paste-quote\n"
1013 		"undo:save\n" /* 1 */
1014 		"seq:huuuD\n"
1015 		"undo:undo\n"
1016 		"undo:test:1\n"
1017 		"undo:redo\n"
1018 		"type:X\n"
1019 		"seq:ddenn\n"
1020 		"type:line 4\n"
1021 		"undo:drop\n"
1022 		"undo:save\n" /* 1 */
1023 		"seq:hSuusD\n"
1024 		"undo:undo\n"
1025 		"undo:test:1\n"
1026 		"undo:redo\n",
1027 		HTML_PREFIX "<div style=\"width: 71ch;\">line 0</div>"
1028 		"<blockquote type=\"cite\">"
1029 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "Xline 1</pre>"
1030 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "line 2</pre>"
1031 		"</blockquote>"
1032 		"<div style=\"width: 71ch;\">line 4</div>"
1033 		HTML_SUFFIX,
1034 		"line 0\n"
1035 		"> Xline 1\n"
1036 		"> line 2\n"
1037 		"line 4\n"))
1038 		g_test_fail ();
1039 }
1040 
1041 static void
test_bug_781722(TestFixture * fixture)1042 test_bug_781722 (TestFixture *fixture)
1043 {
1044 	if (!test_utils_process_commands (fixture,
1045 		"mode:plain\n")) {
1046 		g_test_fail ();
1047 		return;
1048 	}
1049 
1050 	test_utils_insert_content (fixture,
1051 		"<pre>Signed-off-by: User &lt;<a href=\"mailto:user@no.where\">user@no.where</a>&gt;\n"
1052 		"</pre><span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
1053 		"<span class=\"-x-evo-cite-body\"></span>",
1054 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1055 
1056 	if (!test_utils_run_simple_test (fixture,
1057 		"seq:dd\n"
1058 		"action:style-preformat\n",
1059 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
1060 		"<blockquote type=\"cite\">"
1061 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "Signed-off-by: User &lt;<a href=\"mailto:user@no.where\">user@no.where</a>&gt;</pre>"
1062 		"</blockquote>"
1063 		HTML_SUFFIX,
1064 		"Credits:\n"
1065 		"> Signed-off-by: User <user@no.where>\n"))
1066 		g_test_fail ();
1067 }
1068 
1069 static void
test_bug_781116(TestFixture * fixture)1070 test_bug_781116 (TestFixture *fixture)
1071 {
1072 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", FALSE);
1073 
1074 	if (!test_utils_process_commands (fixture,
1075 		"mode:plain\n")) {
1076 		g_test_fail ();
1077 		return;
1078 	}
1079 
1080 	test_utils_insert_content (fixture,
1081 		"<pre>a very long text, which splits into multiple lines when this paragraph is not marked as preformatted, but as normal, as it should be</pre>\n"
1082 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
1083 		"<span class=\"-x-evo-cite-body\"></span>",
1084 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1085 
1086 	if (!test_utils_run_simple_test (fixture,
1087 		"seq:dd\n"
1088 		"action:wrap-lines\n",
1089 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
1090 		"<blockquote type=\"cite\">"
1091 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "a very long text, which splits into multiple lines when this<br>"
1092 		QUOTE_SPAN (QUOTE_CHR) "paragraph is not marked as preformatted, but as normal, as it should<br>"
1093 		QUOTE_SPAN (QUOTE_CHR) "be</pre>"
1094 		"</blockquote>"
1095 		HTML_SUFFIX,
1096 		"Credits:\n"
1097 		"> a very long text, which splits into multiple lines when this\n"
1098 		"> paragraph is not marked as preformatted, but as normal, as it should\n"
1099 		"> be\n")) {
1100 		g_test_fail ();
1101 		return;
1102 	}
1103 
1104 	test_utils_insert_content (fixture,
1105 		"<blockquote type=\"cite\"><div>a very long text, which splits into multiple lines when this paragraph is not marked as preformatted, but as normal, as it should be</div></blockquote>"
1106 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>",
1107 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1108 
1109 	if (!test_utils_run_simple_test (fixture,
1110 		"seq:dd\n"
1111 		"action:wrap-lines\n",
1112 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
1113 		"<blockquote type=\"cite\">"
1114 		"<div>" QUOTE_SPAN (QUOTE_CHR) "a very long text, which splits into multiple lines when this<br>"
1115 		QUOTE_SPAN (QUOTE_CHR) "paragraph is not marked as preformatted, but as normal, as it should<br>"
1116 		QUOTE_SPAN (QUOTE_CHR) "be</div>"
1117 		"</blockquote>"
1118 		HTML_SUFFIX,
1119 		"Credits:\n"
1120 		"> a very long text, which splits into multiple lines when this\n"
1121 		"> paragraph is not marked as preformatted, but as normal, as it should\n"
1122 		"> be\n")) {
1123 		g_test_fail ();
1124 		return;
1125 	}
1126 
1127 	if (!test_utils_process_commands (fixture,
1128 		"mode:html\n")) {
1129 		g_test_fail ();
1130 		return;
1131 	}
1132 
1133 	test_utils_insert_content (fixture,
1134 		"<blockquote type=\"cite\"><div>a very long text, which splits into multiple lines when this paragraph is not marked as preformatted, but as normal, as it should be</div></blockquote>"
1135 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>",
1136 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1137 
1138 	if (!test_utils_run_simple_test (fixture,
1139 		"seq:dd\n"
1140 		"action:wrap-lines\n",
1141 		HTML_PREFIX "<div>Credits:</div>"
1142 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
1143 		"<div>a very long text, which splits into multiple lines when this paragraph<br>"
1144 		"is not marked as preformatted, but as normal, as it should be</div>"
1145 		"</blockquote>"
1146 		HTML_SUFFIX,
1147 		"Credits:\n"
1148 		"> a very long text, which splits into multiple lines when this\n"
1149 		"> paragraph\n"
1150 		"> is not marked as preformatted, but as normal, as it should be\n"))
1151 		g_test_fail ();
1152 }
1153 
1154 static void
test_bug_780088(TestFixture * fixture)1155 test_bug_780088 (TestFixture *fixture)
1156 {
1157 	if (!test_utils_process_commands (fixture,
1158 		"mode:plain\n")) {
1159 		g_test_fail ();
1160 		return;
1161 	}
1162 
1163 	test_utils_set_clipboard_text ("Seeing @blah instead of @foo XX'ed on" UNICODE_NBSP "https://example.sub" UNICODE_NBSP "domain.org/page I'd"
1164 		" recommend to XX YY <https://example.subdomain.org/p/user/> , click fjwvne on the left, click skjd sjewncj on the right, and set"
1165 		" wqje wjfdn Xs to something like wqjfnm www.example.com/~user wjfdncj or such.", FALSE);
1166 
1167 	if (!test_utils_run_simple_test (fixture,
1168 		"action:paste\n"
1169 		"seq:n",
1170 		HTML_PREFIX "<div style=\"width: 71ch;\">"
1171 		"Seeing @blah instead of @foo XX'ed on&nbsp;<a href=\"https://example.sub\">https://example.sub</a>"
1172 		"&nbsp;domain.org/page I'd recommend to XX YY "
1173 		"&lt;<a href=\"https://example.subdomain.org/p/user/\">https://example.subdomain.org/p/user/</a>&gt; , "
1174 		"click fjwvne on the left, click skjd sjewncj on the right, and set wqje wjfdn Xs to something like "
1175 		"wqjfnm <a href=\"https://www.example.com/~user\">www.example.com/~user</a> wjfdncj or such.</div>"
1176 		"<div style=\"width: 71ch;\"><br></div>"
1177 		HTML_SUFFIX,
1178 		"Seeing @blah instead of @foo XX'ed\n"
1179 		"on" UNICODE_NBSP "https://example.sub" UNICODE_NBSP "domain.org/page I'd recommend to XX YY\n"
1180 		"<https://example.subdomain.org/p/user/> , click fjwvne on the left,\n"
1181 		"click skjd sjewncj on the right, and set wqje wjfdn Xs to something\n"
1182 		"like wqjfnm www.example.com/~user wjfdncj or such.\n\n"))
1183 		g_test_fail ();
1184 }
1185 
1186 static void
test_bug_788829(TestFixture * fixture)1187 test_bug_788829 (TestFixture *fixture)
1188 {
1189 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", TRUE);
1190 	test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail", "composer-word-wrap-length", 71);
1191 
1192 	if (!test_utils_process_commands (fixture,
1193 		"mode:plain\n")) {
1194 		g_test_fail ();
1195 		return;
1196 	}
1197 
1198 	test_utils_insert_content (fixture,
1199 		"<div>Xxxxx xx xxxxxxxxx xx xxxxxxx xx xxxxx xxxx xxxx xx xxx xxx xxxx xxx xxxçx xôxé "
1200 		"\"xxxxx xxxx xxxxxxx xxx\" xx xxxx xxxxé xxx xxx xxxéx xxx x'x xéxxxxé x'xxxxxxxxx xx "
1201 		"xxx \"<a href=\"https://gnome.org\">Xxxx XXX Xxxxxx Xxx</a>\". Xx xxxx xxxxxxxx xxx <a"
1202 		" href=\"https://gnome.org/\">xxxxxxxxxxxxxxxx.xx</a> (xxxxxxx xxxxxxxxxx xx .xxx). Xxxx "
1203 		"êxxx xxx xxxxxxxxxxx xxxéxxxxxxxx, xxxx xxxxx xx XXX xx xéxxx à xx xxx \"xxx xxxxxx xxxx "
1204 		"xx xxxxxxx\" xx xxxx xx xxxxx xxxxxxxx xxxxxxxx xx $ xx xxxx x'xxxxxx.</div><div><br>"
1205 		"</div><div>Xxxx xx xéxxxxxxx, xxxxxxxx xxxxxxx (!), xxxxxxx à xxx, xxxx ooo$ XXX xxxxé: "
1206 		"<a href=\"https://gnome.org\">https://xxxxxxxxxxxxxxxx.xx/xxxxxxx/xxxxx-xxxx-xxxxxxxx-x"
1207 		"xxxx-xxxx-xxx-xxxxxxxx-xxx/</a> xx xx xxxx xéxéxxxxxxx x'xxxxxx xxxx xx xxxxxx xx xxxxxx"
1208 		"xxxxxx xx xxx (xxxxx Xxxxxx) xxxx xxxx x'xxxxxxx xx xxxxxx: <a href=\"https://gnome.org\">"
1209 		"https://xxxxxxxxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxxxxxxxxx-Xxxxx-Xxxx-XXX-Xxxxxx-Xxx.xxx"
1210 		"</a></div><div><br></div><div>Xxxx xxx xxx xxxxxxx xxxxxxxéxx x'xxxêxxxx à xxxxx, xxx xx x"
1211 		"xxxé xx oooxooo xxxxx xxxxx xxxx... xxxx x'xxx xxxxxxxxxxxx xxxxx xxx xxxxxxxx xx \"xx xxx"
1212 		"xx xxx xxx xxxxxxx xxxxxxx xxxxxxxxxxxxxx xxxx xxxxx xxxxxx xx xx xxxx xx x'xxxxxx\". Xx "
1213 		"xxxx-êxxx xxx xx xxxxxxxx xx xxxx \"x'xxxêxx à xxxxx xx oooxooo xxxx xxx xéxxxxxxxx, xxxx"
1214 		"\"...</div><div><br></div><div>Xxxxx xxxxxx'xx xxx x xxxx xxxxxxx xxxxx xx xxèx xxxxxxxxx "
1215 		"xxxxxxxxxxxxxxxx à xx xxx x'xx xx xêxx (éxxxxxxxxx xxxx-xx-xxxxxxxx): <a href=\"https://"
1216 		"gnome.org\">https://xxxxxxxxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxx-xxxx-xxx-xxxxxxxxxx-xx"
1217 		"xxx.xxx</a> ;&nbsp;</div><div><br></div><div>...x'x xxxxx xx xxxxxx x'xxxxxx xéxxxxxxx, "
1218 		"xx xxx xxxx xxxxxx x'xxxxxxxxxxx xxxxxx, xxxx <a href=\"https://gnome.org\">https://xxxx"
1219 		"xxxxxxxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/</a> xxxxx xxx <a href=\"https://gnome.org/\""
1220 		">https://xxxxxxxxxxxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/</a> ...</div>"
1221 		"<span class=\"-x-evo-to-body\" data-credits=\"On Today, User wrote:\"></span>"
1222 		"<span class=\"-x-evo-cite-body\"></span>",
1223 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1224 
1225 	if (!test_utils_run_simple_test (fixture,
1226 		"",
1227 		HTML_PREFIX "<div style=\"width: 71ch;\">On Today, User wrote:</div><blockquote type=\"cite\">"
1228 		"<div>" QUOTE_SPAN (QUOTE_CHR) "Xxxxx xx xxxxxxxxx xx xxxxxxx xx xxxxx xxxx xxxx xx xxx xxx xxxx xxx" WRAP_BR_SPC
1229 		QUOTE_SPAN (QUOTE_CHR) "xxxçx xôxé \"xxxxx xxxx xxxxxxx xxx\" xx xxxx xxxxé xxx xxx xxxéx xxx" WRAP_BR_SPC
1230 		QUOTE_SPAN (QUOTE_CHR) "x'x xéxxxxé x'xxxxxxxxx xx xxx \"Xxxx XXX Xxxxxx Xxx\". Xx xxxx" WRAP_BR_SPC
1231 		QUOTE_SPAN (QUOTE_CHR) "xxxxxxxx xxx xxxxxxxxxxxxxxxx.xx (xxxxxxx xxxxxxxxxx xx .xxx). Xxxx" WRAP_BR_SPC
1232 		QUOTE_SPAN (QUOTE_CHR) "êxxx xxx xxxxxxxxxxx xxxéxxxxxxxx, xxxx xxxxx xx XXX xx xéxxx à xx" WRAP_BR_SPC
1233 		QUOTE_SPAN (QUOTE_CHR) "xxx \"xxx xxxxxx xxxx xx xxxxxxx\" xx xxxx xx xxxxx xxxxxxxx xxxxxxxx" WRAP_BR_SPC
1234 		QUOTE_SPAN (QUOTE_CHR) "xx $ xx xxxx x'xxxxxx.</div>"
1235 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
1236 		"<div>" QUOTE_SPAN (QUOTE_CHR) "Xxxx xx xéxxxxxxx, xxxxxxxx xxxxxxx (!), xxxxxxx à xxx, xxxx ooo$ XXX" WRAP_BR_SPC
1237 		QUOTE_SPAN (QUOTE_CHR) "xxxxé:" WRAP_BR_SPC
1238 		QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://xxxxxxxxxxxxxxxx.xx/xxxxxxx/xxxxx-xxxx-xxxxxxxx-xxxxx-xxxx-xxx-xxxxxxxx-xxx/\">https://"
1239 		"xxxxxxxxxxxxxxxx.xx/xxxxxxx/xxxxx-xxxx-xxxxxxxx-xxxxx-xxxx-xxx-xxxxxxxx-xxx/</a>" WRAP_BR_SPC
1240 		QUOTE_SPAN (QUOTE_CHR) "xx xx xxxx xéxéxxxxxxx x'xxxxxx xxxx xx xxxxxx xx xxxxxxxxxxxx xx xxx" WRAP_BR_SPC
1241 		QUOTE_SPAN (QUOTE_CHR) "(xxxxx Xxxxxx) xxxx xxxx x'xxxxxxx xx xxxxxx:" WRAP_BR_SPC
1242 		QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://xxxxxxxxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxxxxxxxxx-Xxxxx-Xxxx-XXX-Xxxxxx-Xxx.xxx\">https://xxxxxx"
1243 		"xxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxxxxxxxxx-Xxxxx-Xxxx-XXX-Xxxxxx-Xxx.xxx</a></div>"
1244 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
1245 		"<div>" QUOTE_SPAN (QUOTE_CHR) "Xxxx xxx xxx xxxxxxx xxxxxxxéxx x'xxxêxxxx à xxxxx, xxx xx xxxxé xx" WRAP_BR_SPC
1246 		QUOTE_SPAN (QUOTE_CHR) "oooxooo xxxxx xxxxx xxxx... xxxx x'xxx xxxxxxxxxxxx xxxxx xxx" WRAP_BR_SPC
1247 		QUOTE_SPAN (QUOTE_CHR) "xxxxxxxx xx \"xx xxxxx xxx xxx xxxxxxx xxxxxxx xxxxxxxxxxxxxx xxxx" WRAP_BR_SPC
1248 		QUOTE_SPAN (QUOTE_CHR) "xxxxx xxxxxx xx xx xxxx xx x'xxxxxx\". Xx xxxx-êxxx xxx xx xxxxxxxx xx" WRAP_BR_SPC
1249 		QUOTE_SPAN (QUOTE_CHR) "xxxx \"x'xxxêxx à xxxxx xx oooxooo xxxx xxx xéxxxxxxxx, xxxx\"...</div>"
1250 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
1251 		"<div>" QUOTE_SPAN (QUOTE_CHR) "Xxxxx xxxxxx'xx xxx x xxxx xxxxxxx xxxxx xx xxèx xxxxxxxxx" WRAP_BR_SPC
1252 		QUOTE_SPAN (QUOTE_CHR) "xxxxxxxxxxxxxxxx à xx xxx x'xx xx xêxx (éxxxxxxxxx xxxx-xx-xxxxxxxx):" WRAP_BR_SPC
1253 		QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://xxxxxxxxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxx-xxxx-xxx-xxxxxxxxxx-xxxxx.xxx\">https://xxxxxx"
1254 		"xxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxx-xxxx-xxx-xxxxxxxxxx-xxxxx.xxx</a>" WRAP_BR_SPC
1255 		QUOTE_SPAN (QUOTE_CHR) ";&nbsp;</div>"
1256 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
1257 		"<div>" QUOTE_SPAN (QUOTE_CHR) "...x'x xxxxx xx xxxxxx x'xxxxxx xéxxxxxxx, xx xxx xxxx xxxxxx" WRAP_BR_SPC
1258 		QUOTE_SPAN (QUOTE_CHR) "x'xxxxxxxxxxx xxxxxx, xxxx" WRAP_BR_SPC
1259 		QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://xxxxxxxxxxxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/\">"
1260 		"https://xxxxxxxxxxxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/</a> xxxxx xxx" WRAP_BR_SPC
1261 		QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://xxxxxxxxxxxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/\">https://xxxxxxxxx"
1262 		"xxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/</a> ...</div></blockquote>" HTML_SUFFIX,
1263 		"On Today, User wrote:\n"
1264 		"> Xxxxx xx xxxxxxxxx xx xxxxxxx xx xxxxx xxxx xxxx xx xxx xxx xxxx xxx\n"
1265 		"> xxxçx xôxé \"xxxxx xxxx xxxxxxx xxx\" xx xxxx xxxxé xxx xxx xxxéx xxx\n"
1266 		"> x'x xéxxxxé x'xxxxxxxxx xx xxx \"Xxxx XXX Xxxxxx Xxx\". Xx xxxx\n"
1267 		"> xxxxxxxx xxx xxxxxxxxxxxxxxxx.xx (xxxxxxx xxxxxxxxxx xx .xxx). Xxxx\n"
1268 		"> êxxx xxx xxxxxxxxxxx xxxéxxxxxxxx, xxxx xxxxx xx XXX xx xéxxx à xx\n"
1269 		"> xxx \"xxx xxxxxx xxxx xx xxxxxxx\" xx xxxx xx xxxxx xxxxxxxx xxxxxxxx\n"
1270 		"> xx $ xx xxxx x'xxxxxx.\n"
1271 		"> \n"
1272 		"> Xxxx xx xéxxxxxxx, xxxxxxxx xxxxxxx (!), xxxxxxx à xxx, xxxx ooo$ XXX\n"
1273 		"> xxxxé:\n"
1274 		"> https://xxxxxxxxxxxxxxxx.xx/xxxxxxx/xxxxx-xxxx-xxxxxxxx-xxxxx-xxxx-xxx-xxxxxxxx-xxx/\n"
1275 		"> xx xx xxxx xéxéxxxxxxx x'xxxxxx xxxx xx xxxxxx xx xxxxxxxxxxxx xx xxx\n"
1276 		"> (xxxxx Xxxxxx) xxxx xxxx x'xxxxxxx xx xxxxxx:\n"
1277 		"> https://xxxxxxxxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxxxxxxxxx-Xxxxx-Xxxx-XXX-Xxxxxx-Xxx.xxx\n"
1278 		"> \n"
1279 		"> Xxxx xxx xxx xxxxxxx xxxxxxxéxx x'xxxêxxxx à xxxxx, xxx xx xxxxé xx\n"
1280 		"> oooxooo xxxxx xxxxx xxxx... xxxx x'xxx xxxxxxxxxxxx xxxxx xxx\n"
1281 		"> xxxxxxxx xx \"xx xxxxx xxx xxx xxxxxxx xxxxxxx xxxxxxxxxxxxxx xxxx\n"
1282 		"> xxxxx xxxxxx xx xx xxxx xx x'xxxxxx\". Xx xxxx-êxxx xxx xx xxxxxxxx xx\n"
1283 		"> xxxx \"x'xxxêxx à xxxxx xx oooxooo xxxx xxx xéxxxxxxxx, xxxx\"...\n"
1284 		"> \n"
1285 		"> Xxxxx xxxxxx'xx xxx x xxxx xxxxxxx xxxxx xx xxèx xxxxxxxxx\n"
1286 		"> xxxxxxxxxxxxxxxx à xx xxx x'xx xx xêxx (éxxxxxxxxx xxxx-xx-xxxxxxxx):\n"
1287 		"> https://xxxxxxxxxxxxxxxx.xxx/xx-xxxxxxx/xxxxxxx/Xxxxx-xxxx-xxx-xxxxxxxxxx-xxxxx.xxx\n"
1288 		"> ; \n"
1289 		"> \n"
1290 		"> ...x'x xxxxx xx xxxxxx x'xxxxxx xéxxxxxxx, xx xxx xxxx xxxxxx\n"
1291 		"> x'xxxxxxxxxxx xxxxxx, xxxx\n"
1292 		"> https://xxxxxxxxxxxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/ xxxxx xxx\n"
1293 		"> https://xxxxxxxxxxxxxxxx.xxx/xxxxxxxx-xxxxxxx-xxxx-xxx-o/ ...\n"))
1294 		g_test_fail ();
1295 }
1296 
1297 static void
test_bug_750636(TestFixture * fixture)1298 test_bug_750636 (TestFixture *fixture)
1299 {
1300 	test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail", "composer-word-wrap-length", 71);
1301 
1302 	if (!test_utils_run_simple_test (fixture,
1303 		"mode:plain\n"
1304 		"type:"
1305 		"12345678901234567890123456789012345678901234567890123456789012345678901"
1306 		"12345678901234567890123456789012345678901234567890123456789012345678901A\\n\\n"
1307 		"1234567890123456789012345678901234567890123456789012345678901234567890 B\\n\\n"
1308 		"12345678901234567890123456789012345678901234567890123456789012345678901     C\\n\\n"
1309 		"1234567890123456789012345678901234567890123456789012345678901234567890     D\\n\\n"
1310 		"12345678901234567890123456789012345678901234567890123456789012345678901" UNICODE_NBSP UNICODE_NBSP UNICODE_NBSP "E\\n\\n"
1311 		"1234567890123456789012345678901234567890123456789012345678901234567890" UNICODE_NBSP UNICODE_NBSP UNICODE_NBSP "F\\n\\n"
1312 		" 1\\n"
1313 		"  2\\n"
1314 		"   3\\n"
1315 		"\\n"
1316 		"prefix text https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890 after text\\n"
1317 		"prefix text https://www.gnome.org/123456789012345678901234567890123 after text\\n"
1318 		"prefix text https://www.gnome.org/12345678901234567890 https://www.gnome.org/12345678901234567890 after text\\n"
1319 		"prefix text https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\\n"
1320 		" next line text\\n"
1321 		"\n",
1322 		HTML_PREFIX "<div style=\"width: 71ch;\">"
1323 		"12345678901234567890123456789012345678901234567890123456789012345678901"
1324 		"12345678901234567890123456789012345678901234567890123456789012345678901A</div>"
1325 		"<div style=\"width: 71ch;\"><br></div><div style=\"width: 71ch;\">"
1326 		"1234567890123456789012345678901234567890123456789012345678901234567890 B</div>"
1327 		"<div style=\"width: 71ch;\"><br></div><div style=\"width: 71ch;\">"
1328 		"12345678901234567890123456789012345678901234567890123456789012345678901     C</div>"
1329 		"<div style=\"width: 71ch;\"><br></div><div style=\"width: 71ch;\">"
1330 		"1234567890123456789012345678901234567890123456789012345678901234567890     D</div>"
1331 		"<div style=\"width: 71ch;\"><br></div><div style=\"width: 71ch;\">"
1332 		"12345678901234567890123456789012345678901234567890123456789012345678901&nbsp;&nbsp;&nbsp;E</div>"
1333 		"<div style=\"width: 71ch;\"><br></div><div style=\"width: 71ch;\">"
1334 		"1234567890123456789012345678901234567890123456789012345678901234567890&nbsp;&nbsp;&nbsp;F</div>"
1335 		"<div style=\"width: 71ch;\"><br></div>"
1336 		"<div style=\"width: 71ch;\"> 1</div>"
1337 		"<div style=\"width: 71ch;\">  2</div>"
1338 		"<div style=\"width: 71ch;\">   3</div>"
1339 		"<div style=\"width: 71ch;\"><br></div>"
1340 		"<div style=\"width: 71ch;\">prefix text <a href=\"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\">"
1341 		"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890</a> after text</div>"
1342 		"<div style=\"width: 71ch;\">prefix text <a href=\"https://www.gnome.org/123456789012345678901234567890123\">"
1343 		"https://www.gnome.org/123456789012345678901234567890123</a> after text</div>"
1344 		"<div style=\"width: 71ch;\">prefix text <a href=\"https://www.gnome.org/12345678901234567890\">"
1345 		"https://www.gnome.org/12345678901234567890</a> <a href=\"https://www.gnome.org/12345678901234567890\">"
1346 		"https://www.gnome.org/12345678901234567890</a> after text</div>"
1347 		"<div style=\"width: 71ch;\">prefix text <a href=\"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\">"
1348 		"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890</a></div>"
1349 		"<div style=\"width: 71ch;\"> next line text</div>"
1350 		"<div style=\"width: 71ch;\"><br></div>"
1351 		HTML_SUFFIX,
1352 		"12345678901234567890123456789012345678901234567890123456789012345678901\n"
1353 		"12345678901234567890123456789012345678901234567890123456789012345678901\n"
1354 		"A\n\n"
1355 		"1234567890123456789012345678901234567890123456789012345678901234567890\n"
1356 		"B\n\n"
1357 		"12345678901234567890123456789012345678901234567890123456789012345678901\n"
1358 		"C\n\n"
1359 		"1234567890123456789012345678901234567890123456789012345678901234567890\n"
1360 		"D\n\n"
1361 		"12345678901234567890123456789012345678901234567890123456789012345678901\n"
1362 		UNICODE_NBSP UNICODE_NBSP UNICODE_NBSP "E\n\n"
1363 		"1234567890123456789012345678901234567890123456789012345678901234567890" UNICODE_NBSP "\n"
1364 		UNICODE_NBSP UNICODE_NBSP "F\n\n"
1365 		" 1\n"
1366 		"  2\n"
1367 		"   3\n"
1368 		"\n"
1369 		"prefix text\n"
1370 		"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\n"
1371 		"after text\n"
1372 		"prefix text https://www.gnome.org/123456789012345678901234567890123\n"
1373 		"after text\n"
1374 		"prefix text https://www.gnome.org/12345678901234567890\n"
1375 		"https://www.gnome.org/12345678901234567890 after text\n"
1376 		"prefix text\n"
1377 		"https://www.gnome.org/1234567890123456789012345678901234567890123456789012345678901234567890\n"
1378 		" next line text\n\n"))
1379 		g_test_fail ();
1380 }
1381 
1382 static void
test_issue_86(TestFixture * fixture)1383 test_issue_86 (TestFixture *fixture)
1384 {
1385 	const gchar *source_text =
1386 		"normal text\n"
1387 		"\n"
1388 		"> level 1\n"
1389 		"> level 1\n"
1390 		"> > level 2\n"
1391 		"> > level 2\n"
1392 		"> >\n"
1393 		"> > level 2\n"
1394 		">\n"
1395 		"> level 1\n"
1396 		"> level 1\n"
1397 		">\n"
1398 		"> > > level 3\n"
1399 		"> > > level 3\n"
1400 		">\n"
1401 		"> > level 2\n"
1402 		"> > level 2\n"
1403 		">\n"
1404 		"> level 1\n"
1405 		"\n"
1406 		"back normal text\n";
1407 	gchar *converted, *to_insert;
1408 
1409 	if (!test_utils_process_commands (fixture,
1410 		"mode:html\n")) {
1411 		g_test_fail ();
1412 		return;
1413 	}
1414 
1415 	converted = camel_text_to_html (source_text,
1416 		CAMEL_MIME_FILTER_TOHTML_PRE |
1417 		CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
1418 		CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES |
1419 		CAMEL_MIME_FILTER_TOHTML_QUOTE_CITATION,
1420 		0xDDDDDD);
1421 
1422 	g_return_if_fail (converted != NULL);
1423 
1424 	to_insert = g_strconcat (converted,
1425 		"<span class=\"-x-evo-to-body\" data-credits=\"On Today, User wrote:\"></span>"
1426 		"<span class=\"-x-evo-cite-body\"></span>",
1427 		NULL);
1428 
1429 	test_utils_insert_content (fixture, to_insert,
1430 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1431 
1432 	if (!test_utils_run_simple_test (fixture,
1433 		"",
1434 		HTML_PREFIX "<div>On Today, User wrote:</div>"
1435 		"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
1436 			"<pre>normal text</pre>"
1437 			"<pre><br></pre>"
1438 			"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
1439 				"<pre>level 1</pre>"
1440 				"<pre>level 1</pre>"
1441 				"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
1442 					"<pre>level 2</pre>"
1443 					"<pre>level 2</pre>"
1444 					"<pre><br></pre>"
1445 					"<pre>level 2</pre>"
1446 				"</blockquote>"
1447 				"<pre><br></pre>"
1448 				"<pre>level 1</pre>"
1449 				"<pre>level 1</pre>"
1450 				"<pre><br></pre>"
1451 				"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
1452 					"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
1453 						"<pre>level 3</pre>"
1454 						"<pre>level 3</pre>"
1455 					"</blockquote>"
1456 				"</blockquote>"
1457 				"<pre><br></pre>"
1458 				"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
1459 					"<pre>level 2</pre>"
1460 					"<pre>level 2</pre>"
1461 				"</blockquote>"
1462 				"<pre><br></pre>"
1463 				"<pre>level 1</pre>"
1464 			"</blockquote>"
1465 			"<pre><br></pre>"
1466 			"<pre>back normal text</pre>"
1467 		"</blockquote>" HTML_SUFFIX,
1468 		"On Today, User wrote:\n"
1469 		"> normal text\n"
1470 		"> \n"
1471 		"> > level 1\n"
1472 		"> > level 1\n"
1473 		"> > > level 2\n"
1474 		"> > > level 2\n"
1475 		"> > > \n"
1476 		"> > > level 2\n"
1477 		"> > \n"
1478 		"> > level 1\n"
1479 		"> > level 1\n"
1480 		"> > \n"
1481 		"> > > > level 3\n"
1482 		"> > > > level 3\n"
1483 		"> > \n"
1484 		"> > > level 2\n"
1485 		"> > > level 2\n"
1486 		"> > \n"
1487 		"> > level 1\n"
1488 		"> \n"
1489 		"> back normal text\n"))
1490 		g_test_fail ();
1491 
1492 	g_free (to_insert);
1493 	g_free (converted);
1494 }
1495 
1496 static void
test_issue_103(TestFixture * fixture)1497 test_issue_103 (TestFixture *fixture)
1498 {
1499 	#define LONG_URL "https://www.example.com/123456789012345678901234567890123456789012345678901234567890"
1500 	#define SHORTER_URL "https://www.example.com/1234567890123456789012345678901234567890"
1501 	#define SHORT_URL "https://www.example.com/"
1502 
1503 	if (!test_utils_run_simple_test (fixture,
1504 		"mode:plain\n"
1505 		"type:before\\n"
1506 		LONG_URL "\\n"
1507 		"after\\n"
1508 		"prefix text " SHORTER_URL " suffix\\n"
1509 		"prefix " SHORT_URL " suffix\\n"
1510 		"end\n",
1511 		HTML_PREFIX "<div style=\"width: 71ch;\">before</div>"
1512 		"<div style=\"width: 71ch;\"><a href=\"" LONG_URL "\">" LONG_URL "</a></div>"
1513 		"<div style=\"width: 71ch;\">after</div>"
1514 		"<div style=\"width: 71ch;\">prefix text <a href=\"" SHORTER_URL "\">" SHORTER_URL "</a> suffix</div>"
1515 		"<div style=\"width: 71ch;\">prefix <a href=\"" SHORT_URL "\">" SHORT_URL "</a> suffix</div>"
1516 		"<div style=\"width: 71ch;\">end</div>"
1517 		HTML_SUFFIX,
1518 		"before\n"
1519 		LONG_URL "\n"
1520 		"after\n"
1521 		"prefix text\n"
1522 		SHORTER_URL " suffix\n"
1523 		"prefix " SHORT_URL " suffix\n"
1524 		"end\n")) {
1525 		g_test_fail ();
1526 		return;
1527 	}
1528 
1529 	#undef SHORT_URL
1530 	#undef SHORTER_URL
1531 	#undef LONG_URL
1532 }
1533 
1534 static void
test_issue_104(TestFixture * fixture)1535 test_issue_104 (TestFixture *fixture)
1536 {
1537 	if (!test_utils_run_simple_test (fixture,
1538 		"mode:plain\n"
1539 		"type:text to replace\n"
1540 		"undo:save\n"	/* 1 */
1541 		"seq:h\n"
1542 		"action:show-replace\n"
1543 		"type:e\t\n"
1544 		"seq:A\n" /* Press 'Alt+A' to press 'Replace All' button */
1545 		"type:a\n"
1546 		"seq:a\n"
1547 		"seq:^\n" /* Close the dialog */
1548 		"undo:undo\n"
1549 		"undo:test:1\n"
1550 		"undo:redo\n",
1551 		HTML_PREFIX "<div style=\"width: 71ch;\">txt to rplac</div>" HTML_SUFFIX,
1552 		"txt to rplac\n"))
1553 		g_test_fail ();
1554 }
1555 
1556 static void
test_issue_107(TestFixture * fixture)1557 test_issue_107 (TestFixture *fixture)
1558 {
1559 	if (!test_utils_process_commands (fixture,
1560 		"mode:plain\n")) {
1561 		g_test_fail ();
1562 		return;
1563 	}
1564 
1565 	test_utils_insert_content (fixture,
1566 		"<pre>text\n"
1567 		"<a href=\"https://www.01.org/\">https://www.01.org/</a>&#160;?\n"
1568 		"<a href=\"https://www.02.org/\">https://www.02.org/</a>&#160;A\n"
1569 		"<a href=\"https://www.03.org/\">https://www.03.org/</a>&#160;ěšč\n"
1570 		"<a href=\"https://www.04.org/\">https://www.04.org/</a> ?\n"
1571 		"<a href=\"https://www.05.org/\">https://www.05.org/</a>\n"
1572 		"<a href=\"https://www.06.org/\">https://www.06.org/</a>&#160;\n"
1573 		"<a href=\"https://www.07.org/\">https://www.07.org/</a>&#160;&#160;\n"
1574 		"<a href=\"https://www.08.org/\">https://www.08.org/</a>&#160;&gt;&#160;&lt;&#160;\n"
1575 		"&lt;<a href=\"https://www.09.org/\">https://www.09.org/</a>&gt;\n"
1576 		"&lt;<a href=\"https://www.10.org/\">https://www.10.org/</a>&#160;?&gt;\n"
1577 		"&#160;<a href=\"https://www.11.org/\">https://www.11.org/</a>&#160;\n"
1578 		"&lt;&#160;<a href=\"https://www.12.org/\">https://www.12.org/</a>&#160;&gt;\n"
1579 		"&#160;&lt;<a href=\"https://www.13.org/\">https://www.13.org/</a>&gt;&#160;\n"
1580 		"Text https://www.14.org/\temail: user@no.where\n"
1581 		"</pre>"
1582 		"<span class=\"-x-evo-to-body\" data-credits=\"On Today, User wrote:\"></span>"
1583 		"<span class=\"-x-evo-cite-body\"></span>",
1584 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1585 
1586 	if (!test_utils_run_simple_test (fixture,
1587 		"",
1588 		HTML_PREFIX
1589 		"<div style=\"width: 71ch;\">On Today, User wrote:</div>"
1590 		"<blockquote type=\"cite\">"
1591 		"<div>" QUOTE_SPAN (QUOTE_CHR) "text</div>"
1592 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.01.org/\">https://www.01.org/</a>&nbsp;?</div>"
1593 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.02.org/\">https://www.02.org/</a>&nbsp;A</div>"
1594 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.03.org/\">https://www.03.org/</a>&nbsp;ěšč</div>"
1595 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.04.org/\">https://www.04.org/</a> ?</div>"
1596 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.05.org/\">https://www.05.org/</a></div>"
1597 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.06.org/\">https://www.06.org/</a>&nbsp;</div>"
1598 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.07.org/\">https://www.07.org/</a>&nbsp;&nbsp;</div>"
1599 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.08.org/\">https://www.08.org/</a>&nbsp;&gt;&nbsp;&lt;&nbsp;</div>"
1600 		"<div>" QUOTE_SPAN (QUOTE_CHR) "&lt;<a href=\"https://www.09.org/\">https://www.09.org/</a>&gt;</div>"
1601 		"<div>" QUOTE_SPAN (QUOTE_CHR) "&lt;<a href=\"https://www.10.org/\">https://www.10.org/</a>&nbsp;?&gt;</div>"
1602 		"<div>" QUOTE_SPAN (QUOTE_CHR) "&nbsp;<a href=\"https://www.11.org/\">https://www.11.org/</a>&nbsp;</div>"
1603 		"<div>" QUOTE_SPAN (QUOTE_CHR) "&lt;&nbsp;<a href=\"https://www.12.org/\">https://www.12.org/</a>&nbsp;&gt;</div>"
1604 		"<div>" QUOTE_SPAN (QUOTE_CHR) "&nbsp;&lt;<a href=\"https://www.13.org/\">https://www.13.org/</a>&gt;&nbsp;</div>"
1605 		"<div>" QUOTE_SPAN (QUOTE_CHR) "Text <a href=\"https://www.14.org/\">https://www.14.org/</a>\temail: <a href=\"mailto:user@no.where\">user@no.where</a></div>"
1606 		"</blockquote>" HTML_SUFFIX,
1607 		"On Today, User wrote:\n"
1608 		"> text\n"
1609 		"> https://www.01.org/" UNICODE_NBSP "?\n"
1610 		"> https://www.02.org/" UNICODE_NBSP "A\n"
1611 		"> https://www.03.org/" UNICODE_NBSP "ěšč\n"
1612 		"> https://www.04.org/ ?\n"
1613 		"> https://www.05.org/\n"
1614 		"> https://www.06.org/" UNICODE_NBSP "\n"
1615 		"> https://www.07.org/" UNICODE_NBSP UNICODE_NBSP "\n"
1616 		"> https://www.08.org/" UNICODE_NBSP ">" UNICODE_NBSP "<" UNICODE_NBSP "\n"
1617 		"> <https://www.09.org/>\n"
1618 		"> <https://www.10.org/" UNICODE_NBSP "?>\n"
1619 		"> " UNICODE_NBSP "https://www.11.org/" UNICODE_NBSP "\n"
1620 		"> <" UNICODE_NBSP "https://www.12.org/" UNICODE_NBSP ">\n"
1621 		"> " UNICODE_NBSP "<https://www.13.org/>" UNICODE_NBSP "\n"
1622 		"> Text https://www.14.org/\temail: user@no.where\n")) {
1623 		g_test_fail ();
1624 	}
1625 }
1626 
1627 static void
test_issue_884(TestFixture * fixture)1628 test_issue_884 (TestFixture *fixture)
1629 {
1630 	if (!test_utils_process_commands (fixture,
1631 		"mode:plain\n")) {
1632 		g_test_fail ();
1633 		return;
1634 	}
1635 
1636 	test_utils_insert_content (fixture,
1637 		"<div>Xxxxx'x \"Xxxx �� Xxxxxxxx �� Xxxx Xxxxxxxxxx �� Xxxxxxxx xxx xxxxxxxxxx xxxxxxxx\" xxxxxxx xxxxx xxxx? Xx xxx, xxxx xx xxxxxxx?</div>"
1638 		"<div><br></div>"
1639 		"<div>123456789 123456789 123456789 123456789 123456789 123456789 123456789 123</div>"
1640 		"<div><br></div>"
1641 		"<div>����������������������������������������������������������������������������"
1642 		"������������������������������������������������������������������������</div>"
1643 		"<div><br></div>"
1644 		"<div>a����������������������������������������������������������������������������</div>"
1645 		"<div><br></div>"
1646 		"<div>ab����������������������������������������������������������������������������</div>"
1647 		"<div><br></div>"
1648 		"<div>abc����������������������������������������������������������������������������</div>"
1649 		/*"<div><br></div>"
1650 		"<div>abcd����������������������������������������������������������������������������������������������</div>"*/,
1651 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1652 
1653 	if (!test_utils_run_simple_test (fixture,
1654 		"",
1655 		HTML_PREFIX
1656 		"<div style=\"width: 71ch;\">Xxxxx'x \"Xxxx �� Xxxxxxxx �� Xxxx Xxxxxxxxxx �� Xxxxxxxx xxx xxxxxxxxxx xxxxxxxx\" xxxxxxx xxxxx xxxx? Xx xxx, xxxx xx xxxxxxx?</div>"
1657 		"<div style=\"width: 71ch;\"><br></div>"
1658 		"<div style=\"width: 71ch;\">123456789 123456789 123456789 123456789 123456789 123456789 123456789 123</div>"
1659 		"<div style=\"width: 71ch;\"><br></div>"
1660 		"<div style=\"width: 71ch;\">����������������������������������������������������������������"
1661 		"������������������������������������������������������������������������������������</div>"
1662 		"<div style=\"width: 71ch;\"><br></div>"
1663 		"<div style=\"width: 71ch;\">a����������������������������������������������������������������������������</div>"
1664 		"<div style=\"width: 71ch;\"><br></div>"
1665 		"<div style=\"width: 71ch;\">ab����������������������������������������������������������������������������</div>"
1666 		"<div style=\"width: 71ch;\"><br></div>"
1667 		"<div style=\"width: 71ch;\">abc����������������������������������������������������������������������������</div>"
1668 		/*"<div style=\"width: 71ch;\"><br></div>"
1669 		"<div style=\"width: 71ch;\">abcd����������������������������������������������������������������������������������������������</div>"*/
1670 		HTML_SUFFIX,
1671 		"Xxxxx'x \"Xxxx �� Xxxxxxxx �� Xxxx Xxxxxxxxxx �� Xxxxxxxx xxx xxxxxxxxxx\n"
1672 		"xxxxxxxx\" xxxxxxx xxxxx xxxx? Xx xxx, xxxx xx xxxxxxx?\n"
1673 		"\n"
1674 		"123456789 123456789 123456789 123456789 123456789 123456789 123456789\n"
1675 		"123\n"
1676 		"\n"
1677 		"������������������������������������������������������������������������\n"
1678 		"������������������������������������������������������������������������\n"
1679 		"����\n"
1680 		"\n"
1681 		"a����������������������������������������������������������������������\n"
1682 		"������\n"
1683 		"\n"
1684 		"ab����������������������������������������������������������������������\n"
1685 		"������\n"
1686 		"\n"
1687 		"abc��������������������������������������������������������������������\n"
1688 		"��������\n"
1689 		/*"\n"
1690 		"abcd����������������������������������������������������������������������������������������������\n"
1691 		"������\n"*/)) {
1692 		g_test_fail ();
1693 	}
1694 }
1695 
1696 static void
test_issue_783(TestFixture * fixture)1697 test_issue_783 (TestFixture *fixture)
1698 {
1699 	if (!test_utils_process_commands (fixture,
1700 		"mode:html\n")) {
1701 		g_test_fail ();
1702 		return;
1703 	}
1704 
1705 	test_utils_insert_content (fixture,
1706 		"<html><head></head><body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" style=\"margin:0;padding:0;background-color:#c8c8c8\">"
1707 		"<div>Mailpoet</div>"
1708 		"</body></html>",
1709 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1710 
1711 	if (!test_utils_run_simple_test (fixture,
1712 		"",
1713 		HTML_PREFIX
1714 		"<div>Mailpoet</div>"
1715 		HTML_SUFFIX,
1716 		"Mailpoet\n")) {
1717 		g_test_fail ();
1718 		return;
1719 	}
1720 
1721 	test_utils_insert_content (fixture,
1722 		"<html><head><style type=\"text/css\">"
1723 		"body {\n"
1724 		"    margin:0;\n"
1725 		"    font:12px/16px Arial, sans-serif;\n"
1726 		"}\n"
1727 		"</style></head><body style=\"margin: 0; font: 12px/ 16px Arial, sans-serif\">"
1728 		"<div>Amazon</div>"
1729 		"</body></html>",
1730 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1731 
1732 	/* WebKit "normalizes" the 'font' rule; the important part is that the margin is gone from the HTML */
1733 	if (!test_utils_run_simple_test (fixture,
1734 		"",
1735 		"<html><head><style type=\"text/css\">"
1736 		"body { font-style: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; "
1737 		"font-size: 12px; line-height: 16px; font-family: Arial, sans-serif; }"
1738 		"</style></head><body style=\"font-style: normal; font-variant-caps: normal; font-weight: normal; "
1739 		"font-stretch: normal; font-size: 12px; line-height: 16px; font-family: Arial, sans-serif;\">"
1740 		"<div>Amazon</div>"
1741 		HTML_SUFFIX,
1742 		"Amazon\n")) {
1743 		g_test_fail ();
1744 		return;
1745 	}
1746 
1747 	test_utils_insert_content (fixture,
1748 		"<html><head><style text=\"text/css\">"
1749 		"body { width: 100% !important; -webkit-text-size-adjust: 100% !important; "
1750 		"-ms-text-size-adjust: 100% !important; -webkit-font-smoothing: antialiased "
1751 		"!important; margin: 0 !important; padding: 0 8px 100px 8px; font-family: "
1752 		"'Market Sans', Helvetica, Arial, sans-serif !important; background-color:#ffffff}"
1753 		"</style></head><body yahoo=\"fix\">"
1754 		"<div>eBay</div>"
1755 		"</body></html>",
1756 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1757 
1758 	if (!test_utils_run_simple_test (fixture,
1759 		"",
1760 		"<html><head><style text=\"text/css\">"
1761 		"body { background-color: rgb(255, 255, 255); width: 100% !important; -webkit-font-smoothing: antialiased !important;"
1762 		" font-family: \"Market Sans\", Helvetica, Arial, sans-serif !important; }"
1763 		"</style></head><body yahoo=\"fix\">"
1764 		"<div>eBay</div>"
1765 		HTML_SUFFIX,
1766 		"eBay\n")) {
1767 		g_test_fail ();
1768 		return;
1769 	}
1770 
1771 	test_utils_insert_content (fixture,
1772 		"<html><head><style text=\"text/css\">"
1773 		"table { color: blue; }\n"
1774 		"body { color: yellow; }\n"
1775 		"body { padding: 10px; }\n"
1776 		"div { color: orange; }"
1777 		"</style></head><body>"
1778 		"<div>Custom</div>"
1779 		"</body></html>",
1780 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
1781 
1782 	if (!test_utils_run_simple_test (fixture,
1783 		"",
1784 		"<html><head><style text=\"text/css\">"
1785 		"table { color: blue; }\n"
1786 		"body { color: yellow; }\n"
1787 		"div { color: orange; }"
1788 		"</style></head><body yahoo=\"fix\">"
1789 		"<div>Custom</div>"
1790 		HTML_SUFFIX,
1791 		"Custom\n")) {
1792 		g_test_fail ();
1793 		return;
1794 	}
1795 }
1796 
1797 static void
test_issue_1197(TestFixture * fixture)1798 test_issue_1197 (TestFixture *fixture)
1799 {
1800 	if (!test_utils_run_simple_test (fixture,
1801 		"mode:plain\n"
1802 		"type:a\\n\\n\\n\\nb\n"
1803 		"seq:uub\n"
1804 		"type:c\n",
1805 		HTML_PREFIX
1806 		"<div style=\"width: 71ch;\">a</div>"
1807 		"<div style=\"width: 71ch;\">c</div>"
1808 		"<div style=\"width: 71ch;\"><br></div>"
1809 		"<div style=\"width: 71ch;\">b</div>"
1810 		HTML_SUFFIX,
1811 		"a\n"
1812 		"c\n"
1813 		"\n"
1814 		"b\n")) {
1815 		g_test_fail ();
1816 		return;
1817 	}
1818 
1819 	if (!test_utils_run_simple_test (fixture,
1820 		"seq:b\n",
1821 		HTML_PREFIX
1822 		"<div style=\"width: 71ch;\">a</div>"
1823 		"<div style=\"width: 71ch;\"><br></div>"
1824 		"<div style=\"width: 71ch;\"><br></div>"
1825 		"<div style=\"width: 71ch;\">b</div>"
1826 		HTML_SUFFIX,
1827 		"a\n"
1828 		"\n"
1829 		"\n"
1830 		"b\n")) {
1831 		g_test_fail ();
1832 		return;
1833 	}
1834 
1835 	if (!test_utils_run_simple_test (fixture,
1836 		"seq:b\n"
1837 		"type:d\n",
1838 		HTML_PREFIX
1839 		"<div style=\"width: 71ch;\">ad</div>"
1840 		"<div style=\"width: 71ch;\"><br></div>"
1841 		"<div style=\"width: 71ch;\">b</div>"
1842 		HTML_SUFFIX,
1843 		"ad\n"
1844 		"\n"
1845 		"b\n")) {
1846 		g_test_fail ();
1847 		return;
1848 	}
1849 
1850 	if (!test_utils_run_simple_test (fixture,
1851 		"seq:bnn\n",
1852 		HTML_PREFIX
1853 		"<div style=\"width: 71ch;\">a</div>"
1854 		"<div style=\"width: 71ch;\"><br></div>"
1855 		"<div style=\"width: 71ch;\"><br></div>"
1856 		"<div style=\"width: 71ch;\"><br></div>"
1857 		"<div style=\"width: 71ch;\">b</div>"
1858 		HTML_SUFFIX,
1859 		"a\n"
1860 		"\n"
1861 		"\n"
1862 		"\n"
1863 		"b\n")) {
1864 		g_test_fail ();
1865 		return;
1866 	}
1867 
1868 	if (!test_utils_run_simple_test (fixture,
1869 		"type:e\n",
1870 		HTML_PREFIX
1871 		"<div style=\"width: 71ch;\">a</div>"
1872 		"<div style=\"width: 71ch;\"><br></div>"
1873 		"<div style=\"width: 71ch;\">e</div>"
1874 		"<div style=\"width: 71ch;\"><br></div>"
1875 		"<div style=\"width: 71ch;\">b</div>"
1876 		HTML_SUFFIX,
1877 		"a\n"
1878 		"\n"
1879 		"e\n"
1880 		"\n"
1881 		"b\n")) {
1882 		g_test_fail ();
1883 		return;
1884 	}
1885 
1886 	if (!test_utils_run_simple_test (fixture,
1887 		"seq:lDD\n"
1888 		"type:f\n",
1889 		HTML_PREFIX
1890 		"<div style=\"width: 71ch;\">a</div>"
1891 		"<div style=\"width: 71ch;\"><br></div>"
1892 		"<div style=\"width: 71ch;\">f</div>"
1893 		"<div style=\"width: 71ch;\">b</div>"
1894 		HTML_SUFFIX,
1895 		"a\n"
1896 		"\n"
1897 		"f\n"
1898 		"b\n")) {
1899 		g_test_fail ();
1900 		return;
1901 	}
1902 
1903 	if (!test_utils_run_simple_test (fixture,
1904 		"seq:bD\n"
1905 		"type:g\n",
1906 		HTML_PREFIX
1907 		"<div style=\"width: 71ch;\">a</div>"
1908 		"<div style=\"width: 71ch;\"><br></div>"
1909 		"<div style=\"width: 71ch;\">gb</div>"
1910 		HTML_SUFFIX,
1911 		"a\n"
1912 		"\n"
1913 		"gb\n")) {
1914 		g_test_fail ();
1915 		return;
1916 	}
1917 
1918 	if (!test_utils_run_simple_test (fixture,
1919 		"seq:bunnuuue\n"
1920 		"mode:html\n"
1921 		"type: \n"
1922 		"action:bold\n"
1923 		"type:bold\n"
1924 		"action:bold\n"
1925 		"type: hh\n"
1926 		"seq:dd",
1927 		HTML_PREFIX
1928 		"<div>a <b>bold</b> hh</div>"
1929 		"<div><br></div>"
1930 		"<div><br></div>"
1931 		"<div><br></div>"
1932 		"<div>b</div>"
1933 		HTML_SUFFIX,
1934 		"a bold hh\n"
1935 		"\n"
1936 		"\n"
1937 		"\n"
1938 		"b\n")) {
1939 		g_test_fail ();
1940 		return;
1941 	}
1942 
1943 	if (!test_utils_run_simple_test (fixture,
1944 		"type:i\n",
1945 		HTML_PREFIX
1946 		"<div>a <b>bold</b> hh</div>"
1947 		"<div><br></div>"
1948 		"<div>i</div>"
1949 		"<div><br></div>"
1950 		"<div>b</div>"
1951 		HTML_SUFFIX,
1952 		"a bold hh\n"
1953 		"\n"
1954 		"i\n"
1955 		"\n"
1956 		"b\n")) {
1957 		g_test_fail ();
1958 		return;
1959 	}
1960 
1961 
1962 	if (!test_utils_run_simple_test (fixture,
1963 		"seq:bbb\n"
1964 		"type:j\n",
1965 		HTML_PREFIX
1966 		"<div>a <b>bold</b> hhj</div>"
1967 		"<div><br></div>"
1968 		"<div>b</div>"
1969 		HTML_SUFFIX,
1970 		"a bold hhj\n"
1971 		"\n"
1972 		"b\n")) {
1973 		g_test_fail ();
1974 		return;
1975 	}
1976 }
1977 
1978 static void
test_issue_913(TestFixture * fixture)1979 test_issue_913 (TestFixture *fixture)
1980 {
1981 	if (!test_utils_process_commands (fixture,
1982 		"mode:html\n")) {
1983 		g_test_fail ();
1984 		return;
1985 	}
1986 
1987 	if (!test_utils_run_simple_test (fixture,
1988 		"type:aa \n"
1989 		"action:size-plus-two\n"
1990 		"type:bb \n"
1991 		"action:bold\n"
1992 		"type:cc\n"
1993 		"action:bold\n"
1994 		"type: dd\n"
1995 		"action:size-plus-zero\n"
1996 		"type:\\nee\n",
1997 		HTML_PREFIX
1998 		"<div>aa <font size=\"5\">bb <b>cc</b> dd</font></div>"
1999 		"<div><font size=\"3\">ee</font></div>"
2000 		HTML_SUFFIX,
2001 		"aa bb cc dd\n"
2002 		"ee\n")) {
2003 		g_test_fail ();
2004 		return;
2005 	}
2006 
2007 	test_utils_insert_signature (fixture,
2008 		"<div>tt <b>uu <i>vv</i> <font size=\"2\">ww</font> xx</b> yy</div>",
2009 		TRUE, "UID", FALSE, FALSE, TRUE);
2010 
2011 	if (!test_utils_run_simple_test (fixture,
2012 		"",
2013 		HTML_PREFIX
2014 		"<div>aa <font size=\"5\">bb <b>cc</b> dd</font></div>"
2015 		"<div><font size=\"3\">ee</font></div>"
2016 		"<div><br></div>"
2017 		"<div><span>"
2018 		"<pre>-- <br></pre>"
2019 		"<div>tt <b>uu <i>vv</i> <font size=\"2\">ww</font> xx</b> yy</div>"
2020 		"</span></div>"
2021 		HTML_SUFFIX,
2022 		"aa bb cc dd\n"
2023 		"ee\n"
2024 		"\n"
2025 		"-- \n"
2026 		"tt uu vv ww xx yy\n")) {
2027 		g_test_fail ();
2028 		return;
2029 	}
2030 
2031 	if (!test_utils_run_simple_test (fixture,
2032 		"mode:plain\n",
2033 		HTML_PREFIX
2034 		"<div style=\"width: 71ch;\">aa bb cc dd</div>"
2035 		"<div style=\"width: 71ch;\">ee</div>"
2036 		"<div style=\"width: 71ch;\"><br></div>"
2037 		"<div style=\"width: 71ch;\"><span>"
2038 		"<pre>-- <br></pre>"
2039 		"<div>tt uu vv ww xx yy</div>"
2040 		"</span></div>"
2041 		HTML_SUFFIX,
2042 		"aa bb cc dd\n"
2043 		"ee\n"
2044 		"\n"
2045 		"-- \n"
2046 		"tt uu vv ww xx yy\n")) {
2047 		g_test_fail ();
2048 		return;
2049 	}
2050 }
2051 
2052 static void
test_issue_1214(TestFixture * fixture)2053 test_issue_1214 (TestFixture *fixture)
2054 {
2055 	if (!test_utils_run_simple_test (fixture,
2056 		"mode:html\n"
2057 		"type:a\\nb\\nc\\nd\\n\n"
2058 		"seq:ChcSddds\n"
2059 		"action:style-list-bullet\n"
2060 		"seq:Chcden\n"
2061 		"type:ee\n"
2062 		"seq:Sdds\n"
2063 		"action:style-normal\n",
2064 		HTML_PREFIX
2065 		"<ul>"
2066 		"<li>a</li>"
2067 		"<li>b</li>"
2068 		"</ul>"
2069 		"<div>ee</div>"
2070 		"<div>c</div>"
2071 		"<div>d</div>"
2072 		"<div><br></div>"
2073 		HTML_SUFFIX,
2074 		" * a\n"
2075 		" * b\n"
2076 		"ee\n"
2077 		"c\n"
2078 		"d\n"
2079 		"\n")) {
2080 		g_test_fail ();
2081 		return;
2082 	}
2083 
2084 	if (!test_utils_run_simple_test (fixture,
2085 		"action:select-all\n"
2086 		"seq:Db\n"
2087 		"type:a\\nb\\nc\\nd\\n\n"
2088 		"seq:ChcSddds\n"
2089 		"action:style-list-bullet\n"
2090 		"seq:Chcden\n"
2091 		"type:ee\n"
2092 		"seq:ddeSuus\n"
2093 		"action:style-normal\n",
2094 		HTML_PREFIX
2095 		"<ul>"
2096 		"<li>a</li>"
2097 		"<li>b</li>"
2098 		"</ul>"
2099 		"<div>ee</div>"
2100 		"<div>c</div>"
2101 		"<div>d</div>"
2102 		"<div><br></div>"
2103 		HTML_SUFFIX,
2104 		" * a\n"
2105 		" * b\n"
2106 		"ee\n"
2107 		"c\n"
2108 		"d\n"
2109 		"\n")) {
2110 		g_test_fail ();
2111 		return;
2112 	}
2113 }
2114 
2115 static void
test_issue_1330(TestFixture * fixture)2116 test_issue_1330 (TestFixture *fixture)
2117 {
2118 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", TRUE);
2119 	test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail", "composer-word-wrap-length", 12);
2120 
2121 	if (!test_utils_process_commands (fixture,
2122 		"mode:plain\n")) {
2123 		g_test_fail ();
2124 		return;
2125 	}
2126 
2127 	test_utils_insert_content (fixture,
2128 		"<body><div>123 567 90 <br></div>"
2129 		"<div>2345678901 <br></div>"
2130 		"<div>34 67 9012 <br></div>"
2131 		"<div>45678 0 2 4 6 8 0</div>"
2132 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2133 		"<span class=\"-x-evo-cite-body\"></span></body>",
2134 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2135 
2136 	if (!test_utils_run_simple_test (fixture,
2137 		"",
2138 		HTML_PREFIX "<div style=\"width: 12ch;\">Credits:</div>"
2139 		"<blockquote type=\"cite\">"
2140 		"<div>" QUOTE_SPAN (QUOTE_CHR) "123 567 90</div>"
2141 		"<div>" QUOTE_SPAN (QUOTE_CHR) "2345678901</div>"
2142 		"<div>" QUOTE_SPAN (QUOTE_CHR) "34 67 9012</div>"
2143 		"<div>" QUOTE_SPAN (QUOTE_CHR) "45678 0 2" WRAP_BR_SPC
2144 		QUOTE_SPAN (QUOTE_CHR) "4 6 8 0</div>"
2145 		"</blockquote>"
2146 		HTML_SUFFIX,
2147 		"Credits:\n"
2148 		"> 123 567 90\n"
2149 		"> 2345678901\n"
2150 		"> 34 67 9012\n"
2151 		"> 45678 0 2\n"
2152 		"> 4 6 8 0\n"))
2153 		g_test_fail ();
2154 }
2155 
2156 static void
test_issue_1157(TestFixture * fixture)2157 test_issue_1157 (TestFixture *fixture)
2158 {
2159 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", TRUE);
2160 	test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail", "composer-word-wrap-length", 12);
2161 
2162 	if (!test_utils_process_commands (fixture,
2163 		"mode:plain\n")) {
2164 		g_test_fail ();
2165 		return;
2166 	}
2167 
2168 	test_utils_insert_content (fixture,
2169 		"<body><div>123 567 90 <br></div>"
2170 		"<div>2345678901 <br></div>"
2171 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2172 		"<span class=\"-x-evo-cite-body\"></span></body>",
2173 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2174 
2175 	test_utils_set_clipboard_text ("http://e.c/", FALSE);
2176 
2177 	if (!test_utils_run_simple_test (fixture,
2178 		"seq:Cecn\n"
2179 		"action:paste\n",
2180 		HTML_PREFIX "<div style=\"width: 12ch;\">Credits:</div>"
2181 		"<blockquote type=\"cite\">"
2182 		"<div style=\"width: 12ch;\">" QUOTE_SPAN (QUOTE_CHR) "123 567 90</div>"
2183 		"<div style=\"width: 12ch;\">" QUOTE_SPAN (QUOTE_CHR) "2345678901</div>"
2184 		"</blockquote>"
2185 		"<div style=\"width: 12ch;\"><a href=\"http://e.c/\">http://e.c/</a></div>"
2186 		HTML_SUFFIX,
2187 		"Credits:\n"
2188 		"> 123 567 90\n"
2189 		"> 2345678901\n"
2190 		"http://e.c/\n"))
2191 		g_test_fail ();
2192 }
2193 
2194 static void
test_issue_1365(TestFixture * fixture)2195 test_issue_1365 (TestFixture *fixture)
2196 {
2197 	test_utils_fixture_change_setting_boolean (fixture, "org.gnome.evolution.mail", "composer-wrap-quoted-text-in-replies", TRUE);
2198 	test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail", "composer-word-wrap-length", 25);
2199 
2200 	if (!test_utils_process_commands (fixture,
2201 		"mode:plain\n")) {
2202 		g_test_fail ();
2203 		return;
2204 	}
2205 
2206 	test_utils_insert_content (fixture,
2207 		"<body><div>aa bb,</div>"
2208 		"<div><br></div>"
2209 		"<div>cc dd. &nbsp;ee ff.</div>"
2210 		"<div><br></div>"
2211 		"<div>xxxx:</div>"
2212 		"<div>123456789 1234 6789 123 56 89.<br><br></div>"
2213 		"<div class=\"gmail_quote\">yyy:</div>"
2214 		"<blockquote type=\"cite\" style=\"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex\">"
2215 		"<pre class=\"k9mail\">zz yy,<br>"
2216 		"<br>"
2217 		"xxx,<br>"
2218 		"www 123456789 12 456 89 123 567 9 12 456 89.<br>"
2219 		"<br>"
2220 		"vv,<br>"
2221 		" uu<br></pre>"
2222 		"<blockquote type=\"cite\" style=\"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex\">"
2223 		"<pre class=\"k9mail\">ZZ YY,<br>"
2224 		"<br>"
2225 		"XXX,<br>"
2226 		"WWW 987654321 98 654 21 987 543 1 98 654 21.<br>"
2227 		"<br>"
2228 		"VV,<br>"
2229 		" UU<br></pre>"
2230 		"</blockquote>"
2231 		"</blockquote>"
2232 		"<div><br></div>"
2233 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2234 		"<span class=\"-x-evo-cite-body\"></span></body>",
2235 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2236 
2237 	if (!test_utils_run_simple_test (fixture,
2238 		"",
2239 		HTML_PREFIX "<div style=\"width: 25ch;\">Credits:</div>"
2240 		"<blockquote type=\"cite\">"
2241 		"<div>" QUOTE_SPAN (QUOTE_CHR) "aa bb,</div>"
2242 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
2243 		"<div>" QUOTE_SPAN (QUOTE_CHR) "cc dd. &nbsp;ee ff.</div>"
2244 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
2245 		"<div>" QUOTE_SPAN (QUOTE_CHR) "xxxx:</div>"
2246 		"<div>" QUOTE_SPAN (QUOTE_CHR) "123456789 1234 6789 123" WRAP_BR_SPC
2247 			QUOTE_SPAN (QUOTE_CHR) "56 89.</div>"
2248 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
2249 		"<div>" QUOTE_SPAN (QUOTE_CHR) "yyy:</div>"
2250 			"<blockquote type=\"cite\">"
2251 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "zz yy,</div>"
2252 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "<br></div>"
2253 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "xxx,</div>"
2254 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "www 123456789 12 456" WRAP_BR_SPC
2255 				QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "89 123 567 9 12 456" WRAP_BR_SPC
2256 				QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "89.</div>"
2257 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "<br></div>"
2258 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "vv,</div>"
2259 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "&nbsp;uu</div>"
2260 			"<blockquote type=\"cite\">"
2261 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "ZZ YY,</div>"
2262 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "<br></div>"
2263 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "XXX,</div>"
2264 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "WWW 987654321 98" WRAP_BR_SPC
2265 				QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "654 21 987 543 1 98" WRAP_BR_SPC
2266 				QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "654 21.</div>"
2267 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "<br></div>"
2268 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "VV,</div>"
2269 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "&nbsp;UU</div>"
2270 			"</blockquote>"
2271 			"</blockquote>"
2272 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
2273 		"</blockquote>"
2274 		HTML_SUFFIX,
2275 		"Credits:\n"
2276 		"> aa bb,\n"
2277 		"> \n"
2278 		"> cc dd. " UNICODE_NBSP "ee ff.\n"
2279 		"> \n"
2280 		"> xxxx:\n"
2281 		"> 123456789 1234 6789 123\n"
2282 		"> 56 89.\n"
2283 		"> \n"
2284 		"> yyy:\n"
2285 		"> > zz yy,\n"
2286 		"> > \n"
2287 		"> > xxx,\n"
2288 		"> > www 123456789 12 456\n"
2289 		"> > 89 123 567 9 12 456\n"
2290 		"> > 89.\n"
2291 		"> > \n"
2292 		"> > vv,\n"
2293 		"> > " UNICODE_NBSP "uu\n"
2294 		"> > > ZZ YY,\n"
2295 		"> > > \n"
2296 		"> > > XXX,\n"
2297 		"> > > WWW 987654321 98\n"
2298 		"> > > 654 21 987 543 1 98\n"
2299 		"> > > 654 21.\n"
2300 		"> > > \n"
2301 		"> > > VV,\n"
2302 		"> > > " UNICODE_NBSP "UU\n"
2303 		"> \n"))
2304 		g_test_fail ();
2305 }
2306 
2307 static void
test_issue_1344(TestFixture * fixture)2308 test_issue_1344 (TestFixture *fixture)
2309 {
2310 	if (!test_utils_run_simple_test (fixture,
2311 		"mode:plain\n"
2312 		"type:\\n\\na\\nb\\n\n"
2313 		"seq:Chcd\n"
2314 		"action:style-list-bullet\n"
2315 		"type:c\n",
2316 		HTML_PREFIX
2317 		"<div style=\"width: 71ch;\"><br></div>"
2318 		"<ul style=\"width: 68ch;\"><li>c</li></ul>"
2319 		"<div style=\"width: 71ch;\">a</div>"
2320 		"<div style=\"width: 71ch;\">b</div>"
2321 		"<div style=\"width: 71ch;\"><br></div>"
2322 		HTML_SUFFIX,
2323 		"\n"
2324 		" * c\n"
2325 		"a\n"
2326 		"b\n"
2327 		"\n"))
2328 		g_test_fail ();
2329 }
2330 
2331 static void
test_issue_1391(TestFixture * fixture)2332 test_issue_1391 (TestFixture *fixture)
2333 {
2334 	if (!test_utils_process_commands (fixture,
2335 		"mode:plain\n")) {
2336 		g_test_fail ();
2337 		return;
2338 	}
2339 
2340 	test_utils_insert_content (fixture,
2341 		"<body><div>a</div>"
2342 		"<div>b</div>"
2343 		"<div>c</div>"
2344 		"<blockquote type=\"cite\" style=\"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex\">"
2345 		"<div>d</div>"
2346 		"<div>ee</div>"
2347 		"<div>f</div>"
2348 		"<blockquote type=\"cite\" style=\"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex\">"
2349 		"<div>g</div>"
2350 		"<div>h</div>"
2351 		"<pre>i</pre>"
2352 		"</blockquote>"
2353 		"</blockquote>"
2354 		"<div><br></div>"
2355 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2356 		"<span class=\"-x-evo-cite-body\"></span></body>",
2357 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2358 
2359 	if (!test_utils_run_simple_test (fixture,
2360 		"seq:Chcdde\n"
2361 		"type:1\n"
2362 		"action:style-preformat\n"
2363 		"seq:dddhr\n"
2364 		"type:2\n"
2365 		"action:style-preformat\n"
2366 		"seq:dddh\n"
2367 		"type:3\n"
2368 		"action:style-preformat\n"
2369 		"seq:de\n"
2370 		"type:4\n"
2371 		"action:style-normal\n",
2372 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
2373 		"<blockquote type=\"cite\">"
2374 		"<div>" QUOTE_SPAN (QUOTE_CHR) "a</div>"
2375 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "b1</pre>"
2376 		"<div>" QUOTE_SPAN (QUOTE_CHR) "c</div>"
2377 			"<blockquote type=\"cite\">"
2378 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "d</div>"
2379 			"<pre>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "e2e</pre>"
2380 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "f</div>"
2381 			"<blockquote type=\"cite\">"
2382 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "g</div>"
2383 			"<pre>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "3h</pre>"
2384 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR QUOTE_CHR) "i4</div>"
2385 			"</blockquote>"
2386 			"</blockquote>"
2387 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
2388 		"</blockquote>"
2389 		HTML_SUFFIX,
2390 		"Credits:\n"
2391 		"> a\n"
2392 		"> b1\n"
2393 		"> c\n"
2394 		"> > d\n"
2395 		"> > e2e\n"
2396 		"> > f\n"
2397 		"> > > g\n"
2398 		"> > > 3h\n"
2399 		"> > > i4\n"
2400 		"> \n"))
2401 		g_test_fail ();
2402 }
2403 
2404 static gboolean
test_issue_1394_with_wrap_length(TestFixture * fixture,gint wrap_length)2405 test_issue_1394_with_wrap_length (TestFixture *fixture,
2406 				  gint wrap_length)
2407 {
2408 	gchar *html;
2409 
2410 	test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail", "composer-word-wrap-length", wrap_length);
2411 
2412 	if (!test_utils_process_commands (fixture,
2413 		"mode:plain\n"))
2414 		return FALSE;
2415 
2416 	test_utils_insert_content (fixture,
2417 		"<body><div>a</div>"
2418 		"<blockquote type=\"cite\">"
2419 		"<div>b</div>"
2420 		"<div><a href=\"https://www.example.com/\">https://www.example.com/</a></div>"
2421 		"<div>c</div>"
2422 		"</blockquote>"
2423 		"<div><br></div>"
2424 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2425 		"<span class=\"-x-evo-cite-body\"></span></body>",
2426 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2427 
2428 	html = g_strdup_printf (
2429 		HTML_PREFIX "<div style=\"width: %dch;\">Credits:</div>"
2430 		"<blockquote type=\"cite\">"
2431 			"<blockquote type=\"cite\">"
2432 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "<a href=\"https://www.example.com/\">https://www.example.com/</a></div>"
2433 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "c</div>"
2434 			"</blockquote>"
2435 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
2436 		"</blockquote>"
2437 		HTML_SUFFIX,
2438 		wrap_length);
2439 
2440 	if (!test_utils_run_simple_test (fixture,
2441 		"undo:save\n"
2442 		"seq:dddSllllsb\n",
2443 		html,
2444 		"Credits:\n"
2445 		"> > https://www.example.com/\n"
2446 		"> > c\n"
2447 		"> \n")) {
2448 		g_free (html);
2449 		return FALSE;
2450 	}
2451 
2452 	g_free (html);
2453 
2454 	if (!test_utils_process_commands (fixture,
2455 		"undo:save\n"
2456 		"undo:undo\n"
2457 		"undo:test:2\n"
2458 		"undo:redo\n"
2459 		"undo:test\n"
2460 		"undo:drop:2"))
2461 		return FALSE;
2462 
2463 	html = g_strdup_printf (
2464 		HTML_PREFIX "<div style=\"width: %dch;\">Credits:<a href=\"https://www.example.com/\">https://www.example.com/</a></div>"
2465 		"<blockquote type=\"cite\">"
2466 			"<blockquote type=\"cite\">"
2467 			"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "c</div>"
2468 			"</blockquote>"
2469 		"<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
2470 		"</blockquote>"
2471 		HTML_SUFFIX,
2472 		wrap_length);
2473 
2474 	if (!test_utils_run_simple_test (fixture,
2475 		"undo:save\n"
2476 		"seq:b\n",
2477 		html,
2478 		"Credits:https://www.example.com/\n"
2479 		"> > c\n"
2480 		"> \n")) {
2481 		g_free (html);
2482 		return FALSE;
2483 	}
2484 
2485 	g_free (html);
2486 
2487 	if (!test_utils_process_commands (fixture,
2488 		"undo:save\n"
2489 		"undo:undo\n"
2490 		"undo:test:2\n"
2491 		"undo:redo\n"
2492 		"undo:test\n"
2493 		"undo:drop:2"))
2494 		return FALSE;
2495 
2496 	return TRUE;
2497 }
2498 
2499 static void
test_issue_1394(TestFixture * fixture)2500 test_issue_1394 (TestFixture *fixture)
2501 {
2502 	if (!test_issue_1394_with_wrap_length (fixture, 50) ||
2503 	    !test_issue_1394_with_wrap_length (fixture, 10))
2504 		g_test_fail ();
2505 }
2506 
2507 static void
test_issue_1159(TestFixture * fixture)2508 test_issue_1159 (TestFixture *fixture)
2509 {
2510 	if (!test_utils_process_commands (fixture,
2511 		"mode:plain\n")) {
2512 		g_test_fail ();
2513 		return;
2514 	}
2515 
2516 	test_utils_insert_content (fixture,
2517 		"<body><div>a</div>"
2518 		"<div>b</div>"
2519 		"<div>c</div>"
2520 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2521 		"<span class=\"-x-evo-cite-body\"></span></body>",
2522 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2523 
2524 	if (!test_utils_run_simple_test (fixture,
2525 		"seq:Cecn\n"
2526 		"seq:ChcddSdds\n"
2527 		"seq:n\n",
2528 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
2529 		"<blockquote type=\"cite\">"
2530 		"<div>" QUOTE_SPAN (QUOTE_CHR) "a</div>"
2531 		"</blockquote>"
2532 		"<div style=\"width: 71ch;\"><br></div>"
2533 		"<div style=\"width: 71ch;\"><br></div>"
2534 		HTML_SUFFIX,
2535 		"Credits:\n"
2536 		"> a\n"
2537 		"\n"
2538 		"\n"))
2539 		g_test_fail ();
2540 }
2541 
2542 static void
test_issue_1424_level1(TestFixture * fixture)2543 test_issue_1424_level1 (TestFixture *fixture)
2544 {
2545 	if (!test_utils_process_commands (fixture,
2546 		"mode:plain\n")) {
2547 		g_test_fail ();
2548 		return;
2549 	}
2550 
2551 	test_utils_insert_content (fixture,
2552 		"<body><div>a</div>"
2553 		"<div>b</div>"
2554 		"<div>c</div>"
2555 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2556 		"<span class=\"-x-evo-cite-body\"></span></body>",
2557 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2558 
2559 	if (!test_utils_run_simple_test (fixture,
2560 		"seq:C\n"
2561 		"type:a\n"
2562 		"seq:c\n"
2563 		"action:style-preformat\n",
2564 		HTML_PREFIX "<pre>Credits:</pre>"
2565 		"<blockquote type=\"cite\">"
2566 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "a</pre>"
2567 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "b</pre>"
2568 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "c</pre>"
2569 		"</blockquote>"
2570 		HTML_SUFFIX,
2571 		"Credits:\n"
2572 		"> a\n"
2573 		"> b\n"
2574 		"> c\n")) {
2575 		g_test_fail ();
2576 		return;
2577 	}
2578 
2579 	if (!test_utils_run_simple_test (fixture,
2580 		"action:style-normal\n",
2581 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
2582 		"<blockquote type=\"cite\">"
2583 		"<div>" QUOTE_SPAN (QUOTE_CHR) "a</div>"
2584 		"<div>" QUOTE_SPAN (QUOTE_CHR) "b</div>"
2585 		"<div>" QUOTE_SPAN (QUOTE_CHR) "c</div>"
2586 		"</blockquote>"
2587 		HTML_SUFFIX,
2588 		"Credits:\n"
2589 		"> a\n"
2590 		"> b\n"
2591 		"> c\n")) {
2592 		g_test_fail ();
2593 		return;
2594 	}
2595 }
2596 
2597 static void
test_issue_1424_level2(TestFixture * fixture)2598 test_issue_1424_level2 (TestFixture *fixture)
2599 {
2600 	if (!test_utils_process_commands (fixture,
2601 		"mode:plain\n")) {
2602 		g_test_fail ();
2603 		return;
2604 	}
2605 
2606 	test_utils_insert_content (fixture,
2607 		"<body><div>a</div>"
2608 		"<blockquote type=\"cite\">"
2609 		"<div>b</div>"
2610 		"<div>c</div>"
2611 		"</blockquote>"
2612 		"<div>d</div>"
2613 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2614 		"<span class=\"-x-evo-cite-body\"></span></body>",
2615 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2616 
2617 	if (!test_utils_run_simple_test (fixture,
2618 		"seq:C\n"
2619 		"type:a\n"
2620 		"seq:c\n"
2621 		"action:style-preformat\n",
2622 		HTML_PREFIX "<pre>Credits:</pre>"
2623 		"<blockquote type=\"cite\">"
2624 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "a</pre>"
2625 		"<blockquote type=\"cite\">"
2626 		"<pre>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "b</pre>"
2627 		"<pre>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "c</pre>"
2628 		"</blockquote>"
2629 		"<pre>" QUOTE_SPAN (QUOTE_CHR) "d</pre>"
2630 		"</blockquote>"
2631 		HTML_SUFFIX,
2632 		"Credits:\n"
2633 		"> a\n"
2634 		"> > b\n"
2635 		"> > c\n"
2636 		"> d\n")) {
2637 		g_test_fail ();
2638 		return;
2639 	}
2640 
2641 	if (!test_utils_run_simple_test (fixture,
2642 		"action:style-normal\n",
2643 		HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
2644 		"<blockquote type=\"cite\">"
2645 		"<div>" QUOTE_SPAN (QUOTE_CHR) "a</div>"
2646 		"<blockquote type=\"cite\">"
2647 		"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "b</div>"
2648 		"<div>" QUOTE_SPAN (QUOTE_CHR QUOTE_CHR) "c</div>"
2649 		"</blockquote>"
2650 		"<div>" QUOTE_SPAN (QUOTE_CHR) "d</div>"
2651 		"</blockquote>"
2652 		HTML_SUFFIX,
2653 		"Credits:\n"
2654 		"> a\n"
2655 		"> > b\n"
2656 		"> > c\n"
2657 		"> d\n")) {
2658 		g_test_fail ();
2659 		return;
2660 	}
2661 }
2662 
2663 static void
test_issue_1439(TestFixture * fixture)2664 test_issue_1439 (TestFixture *fixture)
2665 {
2666 	if (!test_utils_process_commands (fixture,
2667 		"mode:html\n")) {
2668 		g_test_fail ();
2669 		return;
2670 	}
2671 
2672 	test_utils_set_clipboard_text ("The <a href='http://www.example.com/'>example com</a> site", TRUE);
2673 
2674 	if (!test_utils_run_simple_test (fixture,
2675 		"action:style-list-bullet\n"
2676 		"type:l1\\nl2\\n\n"
2677 		"action:paste\n"
2678 		"type:\\nl4\n",
2679 		HTML_PREFIX "<ul>"
2680 		"<li>l1</li>"
2681 		"<li>l2</li>"
2682 		"<li>The <a href='http://www.example.com/'>example com</a> site</li>"
2683 		"<li>l4</li>"
2684 		"</ul>"
2685 		HTML_SUFFIX,
2686 		" * l1\n"
2687 		" * l2\n"
2688 		" * The example com site\n"
2689 		" * l4\n"))
2690 		g_test_fail ();
2691 }
2692 
2693 static void
test_issue_1392(TestFixture * fixture)2694 test_issue_1392 (TestFixture *fixture)
2695 {
2696 	test_utils_fixture_change_setting_int32 (fixture, "org.gnome.evolution.mail", "composer-word-wrap-length", 28);
2697 
2698 	if (!test_utils_process_commands (fixture,
2699 		"mode:plain\n")) {
2700 		g_test_fail ();
2701 		return;
2702 	}
2703 
2704 	test_utils_insert_content (fixture,
2705 		"<body><div>aaaa <a href=\"https://www.example.com/\">www.example.com/aaabbbccc</a> bbbb</div>"
2706 		"<div>ccc</div>"
2707 		"<body><div>dddd <a href=\"https://www.example.com/\">www.example.com/eeefffggg</a> hhh</div>"
2708 		"<div>iii</div>"
2709 		"<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
2710 		"<span class=\"-x-evo-cite-body\"></span></body>",
2711 		E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
2712 
2713 	if (!test_utils_run_simple_test (fixture,
2714 		"seq:ddelbbbblbb\n"
2715 		"type:1\n",
2716 		HTML_PREFIX "<div style=\"width: 28ch;\">Credits:</div>"
2717 		"<blockquote type=\"cite\">"
2718 		"<div>" QUOTE_SPAN (QUOTE_CHR) "aaaa <a href=\"https://www.example.com/aaabbbccc\">www.example.com/a1bc</a>" WRAP_BR_SPC
2719 		QUOTE_SPAN (QUOTE_CHR) "bbbb</div>"
2720 		"<div>" QUOTE_SPAN (QUOTE_CHR) "ccc</div>"
2721 		"<div>" QUOTE_SPAN (QUOTE_CHR) "dddd" WRAP_BR_SPC
2722 		QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.example.com/eeefffggg\">www.example.com/eeefffggg</a>" WRAP_BR_SPC
2723 		QUOTE_SPAN (QUOTE_CHR) "hhh</div>"
2724 		"<div>" QUOTE_SPAN (QUOTE_CHR) "iii</div>"
2725 		"</blockquote>"
2726 		HTML_SUFFIX,
2727 		"Credits:\n"
2728 		"> aaaa www.example.com/a1bc\n"
2729 		"> bbbb\n"
2730 		"> ccc\n"
2731 		"> dddd\n"
2732 		"> www.example.com/eeefffggg\n"
2733 		"> hhh\n"
2734 		"> iii\n")) {
2735 		g_test_fail ();
2736 		return;
2737 	}
2738 
2739 	if (!test_utils_run_simple_test (fixture,
2740 		"seq:hddddbdelbbbblbb\n"
2741 		"type:2\n",
2742 		HTML_PREFIX "<div style=\"width: 28ch;\">Credits:</div>"
2743 		"<blockquote type=\"cite\">"
2744 		"<div>" QUOTE_SPAN (QUOTE_CHR) "aaaa <a href=\"https://www.example.com/aaabbbccc\">www.example.com/a1bc</a>" WRAP_BR_SPC
2745 		QUOTE_SPAN (QUOTE_CHR) "bbbb</div>"
2746 		"<div>" QUOTE_SPAN (QUOTE_CHR) "ccc</div>"
2747 		"<div>" QUOTE_SPAN (QUOTE_CHR) "dddd<a href=\"https://www.example.com/eeefffggg\">www.example.com/e2fg</a>" WRAP_BR_SPC
2748 		QUOTE_SPAN (QUOTE_CHR) "hhh</div>"
2749 		"<div>" QUOTE_SPAN (QUOTE_CHR) "iii</div>"
2750 		"</blockquote>"
2751 		HTML_SUFFIX,
2752 		"Credits:\n"
2753 		"> aaaa www.example.com/a1bc\n"
2754 		"> bbbb\n"
2755 		"> ccc\n"
2756 		"> ddddwww.example.com/e2fg\n"
2757 		"> hhh\n"
2758 		"> iii\n")) {
2759 		g_test_fail ();
2760 		return;
2761 	}
2762 
2763 	if (!test_utils_run_simple_test (fixture,
2764 		"seq:hr\n"
2765 		"type:333\n",
2766 		HTML_PREFIX "<div style=\"width: 28ch;\">Credits:</div>"
2767 		"<blockquote type=\"cite\">"
2768 		"<div>" QUOTE_SPAN (QUOTE_CHR) "aaaa <a href=\"https://www.example.com/aaabbbccc\">www.example.com/a1bc</a>" WRAP_BR_SPC
2769 		QUOTE_SPAN (QUOTE_CHR) "bbbb</div>"
2770 		"<div>" QUOTE_SPAN (QUOTE_CHR) "ccc</div>"
2771 		"<div>" QUOTE_SPAN (QUOTE_CHR) "d333ddd" WRAP_BR
2772 		QUOTE_SPAN (QUOTE_CHR) "<a href=\"https://www.example.com/eeefffggg\">www.example.com/e2fg</a> hhh</div>"
2773 		"<div>" QUOTE_SPAN (QUOTE_CHR) "iii</div>"
2774 		"</blockquote>"
2775 		HTML_SUFFIX,
2776 		"Credits:\n"
2777 		"> aaaa www.example.com/a1bc\n"
2778 		"> bbbb\n"
2779 		"> ccc\n"
2780 		"> d333ddd\n"
2781 		"> www.example.com/e2fg hhh\n"
2782 		"> iii\n"))
2783 		g_test_fail ();
2784 }
2785 
2786 void
test_add_html_editor_bug_tests(void)2787 test_add_html_editor_bug_tests (void)
2788 {
2789 	test_utils_add_test ("/bug/750657", test_bug_750657);
2790 	test_utils_add_test ("/bug/760989", test_bug_760989);
2791 	test_utils_add_test ("/bug/767903", test_bug_767903);
2792 	test_utils_add_test ("/bug/769708", test_bug_769708);
2793 	test_utils_add_test ("/bug/769913", test_bug_769913);
2794 	test_utils_add_test ("/bug/769955", test_bug_769955);
2795 	test_utils_add_test ("/bug/770073", test_bug_770073);
2796 	test_utils_add_test ("/bug/770074", test_bug_770074);
2797 	test_utils_add_test ("/bug/771044", test_bug_771044);
2798 	test_utils_add_test ("/bug/771131", test_bug_771131);
2799 	test_utils_add_test ("/bug/771493", test_bug_771493);
2800 	test_utils_add_test ("/bug/772171", test_bug_772171);
2801 	test_utils_add_test ("/bug/772513", test_bug_772513);
2802 	test_utils_add_test ("/bug/772918", test_bug_772918);
2803 	test_utils_add_test ("/bug/773164", test_bug_773164);
2804 	test_utils_add_test ("/bug/775042", test_bug_775042);
2805 	test_utils_add_test ("/bug/775691", test_bug_775691);
2806 	test_utils_add_test ("/bug/779707", test_bug_779707);
2807 	test_utils_add_test ("/bug/780275-html", test_bug_780275_html);
2808 	test_utils_add_test ("/bug/780275-plain", test_bug_780275_plain);
2809 	test_utils_add_test ("/bug/781722", test_bug_781722);
2810 	test_utils_add_test ("/bug/781116", test_bug_781116);
2811 	test_utils_add_test ("/bug/780088", test_bug_780088);
2812 	test_utils_add_test ("/bug/788829", test_bug_788829);
2813 	test_utils_add_test ("/bug/750636", test_bug_750636);
2814 	test_utils_add_test ("/issue/86", test_issue_86);
2815 	test_utils_add_test ("/issue/103", test_issue_103);
2816 	test_utils_add_test ("/issue/104", test_issue_104);
2817 	test_utils_add_test ("/issue/107", test_issue_107);
2818 	test_utils_add_test ("/issue/884", test_issue_884);
2819 	test_utils_add_test ("/issue/783", test_issue_783);
2820 	test_utils_add_test ("/issue/1197", test_issue_1197);
2821 	test_utils_add_test ("/issue/913", test_issue_913);
2822 	test_utils_add_test ("/issue/1214", test_issue_1214);
2823 	test_utils_add_test ("/issue/1330", test_issue_1330);
2824 	test_utils_add_test ("/issue/1157", test_issue_1157);
2825 	test_utils_add_test ("/issue/1365", test_issue_1365);
2826 	test_utils_add_test ("/issue/1344", test_issue_1344);
2827 	test_utils_add_test ("/issue/1391", test_issue_1391);
2828 	test_utils_add_test ("/issue/1394", test_issue_1394);
2829 	test_utils_add_test ("/issue/1159", test_issue_1159);
2830 	test_utils_add_test ("/issue/1424-level1", test_issue_1424_level1);
2831 	test_utils_add_test ("/issue/1424-level2", test_issue_1424_level2);
2832 	test_utils_add_test ("/issue/1439", test_issue_1439);
2833 	test_utils_add_test ("/issue/1392", test_issue_1392);
2834 }
2835