3 require "#{ENV['PWD']}/scripts/vym-ruby"
10 puts "Press return to continue..."
14 def expect (comment, v_real, v_exp)
16 puts " Ok: #{comment}"
20 puts "Failed: #{comment}. Expected '#{v_exp}', but got '#{v_real}'"
27 def expect_warning_only (comment, v_real, v_exp)
29 puts " Ok: #{comment}"
33 puts "Warning: #{comment}. Expected '#{v_exp}', but got '#{v_real}'"
39 def expect_error (comment, error)
41 puts "Failed: #{comment}. Command did not return error."
44 puts " Ok: #{comment}"
51 puts "\n#{s}\n#{'-' * s.length}\n"
55 # FIXME-2 Missing: check or init default map
66 #n = vym.mapCount.to_i
67 #vym.loadMap (@testmap)
72 puts "\nTests done : #{$tests_total}"
73 puts "Tests passed: #{$tests_passed}"
74 puts "Warnings: #{$tests_warnings}"
75 puts "Tests failed: #{$tests_failed}"
78 #######################
80 heading "Mainwindow checks:"
82 expect_warning_only "Version is #{version}", vym.version, version
84 expect "Loading map '#{@testmap}'", vym.loadMap(@testmap), true
89 #######################
91 heading "Basic checks:"
94 title = "vym map used for testing"
95 expect "map title is '#{title}'", map.getMapTitle, title
96 author ="Uwe Drechsel"
97 expect "Author is '#{author}'", map.getMapAuthor, author
100 expect "select mainbranch A", map.getSelectionString, @main_a
101 expect "getHeadingPlainText", map.getHeadingPlainText, "Main A"
102 expect "branchCount", map.branchCount, 3
105 expect "selectLastBranch", map.getHeadingPlainText, "Main B"
107 map.selectFirstBranch
108 expect "selectFirstBranch", map.getHeadingPlainText, "Main A"
111 expect "selectParent", map.getHeadingPlainText, "MapCenter 0"
113 expect "getDestPath: Got #{map.getDestPath}", map.getDestPath, @testdir + "/testmap.vym"
114 expect "getFileDir: Got #{map.getFileDir}", map.getFileDir, @testdir + "/"
117 #######################
118 def test_export (vym)
120 map = init_map( vym )
123 exportdir = "#{@testdir}/export-html"
125 htmlpath = "#{exportdir}/output.html"
126 flagdir = "#{exportdir}/flags"
127 pngpath = "#{exportdir}/output.png"
128 csspath = "#{exportdir}/vym.css"
129 map.exportMap("HTML", htmlpath, exportdir)
130 expect "exportHTML: HTML file exists", File.exists?(htmlpath), true
131 expect "exportHTML: HTML image exists", File.exists?(pngpath), true
132 expect "exportHTML: HTML flags dir exists", Dir.exists?(flagdir), true
133 if Dir.exists?(flagdir)
134 expect "exportHTML: HTML flags dir not empty", Dir.empty?(flagdir), false
136 expect "exportHTML: HTML CSS exists", File.exists?(csspath), true
137 File.delete(htmlpath)
138 FileUtils.rm_r(flagdir)
141 map.exportMap("Last")
142 expect "exportLast: HTML #{htmlpath} file exists", File.exists?(htmlpath), true
143 expect "exportLast: HTML image exists", File.exists?(pngpath), true
144 expect "exportHTML: HTML flags dir exists", Dir.exists?(flagdir), true
145 if Dir.exists?(flagdir)
146 expect "exportHTML: HTML flags dir not empty", Dir.empty?(flagdir), false
148 expect "exportLast: HTML CSS exists", File.exists?(csspath), true
151 exportdir = "#{@testdir}/export-ao"
153 filepath = "#{exportdir}/output.txt"
154 map.exportMap("AO", filepath)
155 expect "exportAO: AO file exists", File.exists?(filepath), true
156 File.delete(filepath)
157 map.exportMap("Last")
158 expect "exportLast: AO file exists", File.exists?(filepath), true
161 exportdir = "#{@testdir}/export-ascii"
163 filepath = "#{exportdir}/output.txt"
164 map.exportMap("ASCII", filepath, false)
165 expect "exportASCII: ASCII file exists", File.exists?(filepath), true
166 File.delete(filepath)
167 map.exportMap("Last")
168 expect "exportLast: ASCII file exists", File.exists?(filepath), true
171 exportdir = "#{@testdir}/export-csv"
173 filepath = "#{exportdir}/output.csv"
174 map.exportMap("CSV", filepath)
175 expect "exportCSV: CSV file exists", File.exists?(filepath), true
176 File.delete(filepath)
177 map.exportMap("Last")
178 expect "exportLast: CSV file exists", File.exists?(filepath), true
181 exportdir = "#{@testdir}/export-image"
183 filepath = "#{exportdir}/output.png"
184 map.exportMap("Image", filepath,"PNG")
185 expect "exportImage: PNG file exists", File.exists?(filepath), true
186 File.delete(filepath)
187 map.exportMap("Last")
188 expect "exportLast: PNG file exists", File.exists?(filepath), true
191 exportdir = "#{@testdir}/export-latex"
193 filepath = "#{exportdir}/output.tex"
194 map.exportMap("LaTeX", filepath)
195 expect "exportLaTeX: LaTeX file exists", File.exists?(filepath), true
196 File.delete(filepath)
197 map.exportMap("Last")
198 expect "exportLast: LaTeX file exists", File.exists?(filepath), true
201 exportdir = "#{@testdir}/export-markdown"
203 filepath = "#{exportdir}/output.md"
204 map.exportMap("Markdown", filepath)
205 expect "exportMarkdown: Markdown file exists", File.exists?(filepath), true
206 File.delete(filepath)
207 map.exportMap("Last")
208 expect "exportLast: Markdown file exists", File.exists?(filepath), true
211 exportdir = "#{@testdir}/export-orgmode"
213 filepath = "#{exportdir}/output.org"
214 map.exportMap("OrgMode", filepath)
215 expect "exportOrgMode: OrgMode file exists", File.exists?(filepath), true
216 File.delete(filepath)
217 map.exportMap("Last")
218 expect "exportLast: OrgMode file exists", File.exists?(filepath), true
221 exportdir = "#{@testdir}/export-pdf"
223 filepath = "#{exportdir}/output.pdf"
224 map.exportMap("PDF", filepath)
225 expect "exportPDF: PDF file exists", File.exists?(filepath), true
226 File.delete(filepath)
227 map.exportMap("Last")
228 expect "exportLast: PDF file exists", File.exists?(filepath), true
231 exportdir = "#{@testdir}/export-svg"
233 filepath = "#{exportdir}/output.svg"
234 map.exportMap("SVG", filepath)
235 expect "exportSVG: SVG file exists", File.exists?(filepath), true
236 File.delete(filepath)
237 map.exportMap("Last")
238 expect "exportLast: SVG file exists", File.exists?(filepath), true
241 exportdir = "#{@testdir}/export-xml"
243 filepath = "#{exportdir}/output.xml"
244 map.exportMap("XML", filepath, @testdir)
245 expect "exportXML: XML file exists", File.exists?(filepath), true
246 File.delete(filepath)
247 map.exportMap("Last")
248 expect "exportLast: XML file exists", File.exists?(filepath), true
250 #OpenOffice Impress //FIXME-2
251 #Taskjuggler //FIXME-3
254 #######################
255 def test_extrainfo (vym)
256 heading "Extra information:"
257 map = init_map( vym )
258 map.setMapAuthor("Fra Erasmas")
259 expect "Set and get map author", map.getMapAuthor, "Fra Erasmas"
260 map.setMapComment("xy z")
261 expect "Set and get map comment", map.getMapComment, "xy z"
262 map.setMapTitle("vym rules!")
263 expect "Set and get map title", map.getMapTitle, "vym rules!"
266 #######################
267 def test_adding_branches (vym)
268 heading "Adding branches:"
269 map = init_map( vym )
271 n = map.branchCount.to_i
273 expect( "addBranch", map.branchCount.to_i, n + 1 )
275 map.selectLatestAdded
276 expect "selectLatestAdded", map.getSelectionString, @main_a + ",bo:3"
279 expect( "Undo: addBranch", map.branchCount.to_i, n )
281 map = init_map( vym )
283 n = map.branchCount.to_i
288 expect "addBranchAbove/Below", map.branchCount.to_i, n + 2
292 expect "Undo: addBranchAbove/Below", map.branchCount.to_i, n
294 map = init_map( vym )
298 expect "addBranchBefore: check branchcount", map.branchCount.to_i, n
300 expect "addBranchBefore: check heading", map.getHeadingPlainText, ""
302 # Undo twice: addBranchNew and relinkTo
306 expect "Undo: addBranchBefore", map.branchCount.to_i, n
309 #######################
310 def test_adding_maps (vym)
311 heading "Adding maps"
312 map = init_map( vym )
314 n=map.branchCount.to_i
315 map.addMapReplace "test/default.vym"
317 expect "addMapReplace: check branch count in #{@main_a}", map.branchCount.to_i, n + @n_centers -1
319 expect "addMapReplace: check if #{@branch_a} is new", map.branchCount.to_i, 2
323 expect "Undo: check branch count in #{@main_a}", map.branchCount.to_i, 3
325 expect "Undo: check if #{@branch_a} is back", map.branchCount.to_i, 3
327 map = init_map( vym )
329 map.addMapInsert "test/default.vym", 1
331 expect "addMapInsert: branch count", map.branchCount.to_i, n + 2
332 map.select @main_a + ",bo:1"
333 expect "addMapInsert: new heading", map.getHeadingPlainText, "MapCenter 0"
337 expect "Undo: check branch count in #{@main_a}", map.branchCount.to_i, 3
339 expect "Undo: check heading of #{@branch_b}", map.getHeadingPlainText, "branch b"
342 #######################
343 def test_scrolling (vym)
344 heading "Scrolling and unscrolling"
345 map = init_map( vym )
348 expect "toggleScroll", map.isScrolled, true
350 expect "undo toggleScroll", map.isScrolled, false
352 expect "scroll", map.isScrolled, true
354 expect "unscroll", map.isScrolled, false
356 map = init_map( vym )
363 expect "unscrollChildren", map.isScrolled, false
365 expect "undo unscrollChildren", map.isScrolled, true
371 #######################
372 def test_moving_parts (vym)
373 heading "Moving parts"
374 map = init_map( vym )
378 expect "Moving down", map.getHeadingPlainText, "branch b"
381 expect "Undo Moving down", map.getHeadingPlainText, "branch a"
383 map = init_map( vym )
387 expect "Moving up", map.getHeadingPlainText, "branch b"
390 expect "Undo Moving up", map.getHeadingPlainText, "branch b"
392 map = init_map( vym )
394 n=map.branchCount.to_i
396 map.relinkTo @main_b,0,0,0
398 expect "RelinkTo #{@main_b}: branchCount increased there", map.branchCount.to_i, n+1
402 expect "Undo: RelinkTo #{@main_b}: branchCount decreased there", map.branchCount.to_i, n
404 map = init_map( vym )
406 err = map.relinkTo @branch_a,0,0,0
407 expect_error "RelinkTo myself fails.", err
410 map = init_map( vym )
412 n=map.branchCount.to_i
414 map.relinkTo @branch_a, 1, 0, 0
416 expect "RelinkTo #{@branch_a}, pos 1: branchCount increased there", map.branchCount.to_i, n+1
417 map.select "#{@branch_a},bo:1"
418 expect "RelinkTo #{@branch_a}, pos 1: Mainbranch really moved", map.getHeadingPlainText, "Main B"
421 expect "Undo RelinkTo pos 1: branchCount of center", map.branchCount.to_i, 2
422 # FIXME-2 still has wrong position, check position
427 #######################
428 def test_modify_branches (vym)
429 heading "Modifying branches"
430 map = init_map( vym )
432 map.setHeadingPlainText "Changed!"
433 expect "setHeadingPlainText", map.getHeadingPlainText, "Changed!"
435 expect "Undo: setHeadingPlainText", map.getHeadingPlainText, "branch a"
437 expect "redo: setHeadingPlainText", map.getHeadingPlainText, "Changed!"
441 #######################
444 map = init_map( vym )
447 def set_flags (map, flags)
449 map.setFlagByName( f )
450 expect "Flag set: #{f}", map.hasActiveFlag( f ), true
454 def unset_flags (map, flags)
456 map.unsetFlagByName( f )
457 expect "Flag unset: #{f}", map.hasActiveFlag( f ), false
461 # Group standard-mark
462 set_flags( map, [ "exclamationmark","questionmark"] )
464 # Group standard-status
465 set_flags( map, [ "hook-green",
470 # Group standard-smiley
471 smileys = [ "smiley-good",
474 set_flags( map, smileys )
476 # Group standard-arrow
477 set_flags( map, [ "arrow-up",
482 # Group standard-thumb
483 set_flags( map, [ "thumb-up", "thumb-down" ] )
486 set_flags( map, [ "clock",
496 unset_flags( map, smileys )
499 expect "clearFlags cleared exclamationmark", map.hasActiveFlag( "exclamationmark" ), false
500 expect "clearFlags cleared smiley-good", map.hasActiveFlag( "smiley-good" ), false
504 a = ["stopsign", "lifebelt"]
506 puts "Flag is now: #{flag}"
507 map.toggleFlagByName flag
508 expect "toggleFlag: flag #{flag} activated", map.hasActiveFlag(flag), true
510 map.toggleFlagByName flag
511 expect "toggleFlag: flag #{flag} deactivated", map.hasActiveFlag(flag), false
515 #######################
516 def test_delete_parts (vym)
517 heading "Deleting parts"
518 map = init_map( vym )
520 n = map.branchCount.to_i
522 m = map.branchCount.to_i
525 expect "Remove branch: branchcount", map.branchCount.to_i, n - 1
528 expect "Undo Remove branch: branchcount parent", map.branchCount.to_i, n
530 expect "Undo Remove branch: branchcount restored branch", map.branchCount.to_i, m
532 map = init_map( vym )
534 n = map.branchCount.to_i
537 expect "removeChildren: branchcount", map.branchCount.to_i, 0
540 expect "Undo: removeChildren: branchcount", map.branchCount.to_i, n
542 map = init_map( vym )
544 n=map.branchCount.to_i
546 m=map.branchCount.to_i
547 map.removeKeepChildren
549 expect "removeKeepChildren: branchcount", map.branchCount.to_i, n + m - 1
552 expect "Undo: removeKeepChildren: branchcount of parent", map.branchCount.to_i, n
554 expect "Undo: removeKeepChildren: branchcount of branch", map.branchCount.to_i, m
556 map = init_map( vym )
557 n = map.centerCount.to_i
560 expect "remove mapCenter: number of centers decreased", map.centerCount.to_i, n - 1
562 expect "Undo remove mapCenter: number of centers increased", map.centerCount.to_i, n
565 #######################
566 def test_copy_paste (vym)
567 heading "Copy, cut & Paste"
568 map = init_map( vym )
570 n = map.branchCount.to_i
574 map.selectLatestAdded #FIXME-2 not set for ImportAdd, which is used by paste
575 s = map.getSelectionString
576 expect "Normal paste of branch, check heading of #{s}", map.getHeadingPlainText, "Main A"
580 expect "Undo paste: branchCount of #{@main_a}", map.branchCount.to_i, n
584 expect "redo paste: check heading", map.getHeadingPlainText, "Main A"
589 expect "cut: branchCount of #{@main_a}", map.branchCount.to_i, n
592 map.selectLastChildBranch
593 s = map.getSelectionString
594 expect "Normal paste of branch, check heading of #{s}", map.getHeadingPlainText, "branch a"
598 #######################
599 def test_references (vym)
601 map = init_map( vym )
603 url = "www.insilmaril.de"
605 expect "setURL to '#{url}'", map.getURL, url
608 expect "undo setURL", map.getURL, ""
610 expect "redo setURL", map.getURL, url
612 expect "setURL: unset URL with empty string", map.getURL, ""
617 expect "setVymLink returns absolute path", map.getVymLink, map.getFileDir + vl
619 expect "undo: setVymLink", map.getVymLink, ""
621 expect "redo: setVymLink", map.getVymLink, s
625 #######################
626 def test_history (vym)
628 map = init_map( vym )
630 map.setHeadingPlainText "A"
631 map.setHeadingPlainText "B"
632 map.setHeadingPlainText "C"
636 expect "Undo 3 times", map.getHeadingPlainText, "Main A"
638 expect "Redo once", map.getHeadingPlainText, "A"
641 expect "Redo once more", map.getHeadingPlainText, "B"
643 expect "Redo yet again", map.getHeadingPlainText, "C"
644 map.setHeadingPlainText "Main A"
646 map.selectLastChildBranch
647 expect "Paste from the past", map.getHeadingPlainText, "A"
651 #######################
652 def test_xlinks (vym)
654 map = init_map( vym )
655 map.addXLink("mc:0,bo:0","mc:0,bo:1",2,"#ff0000","Qt::DashDotLine")
656 map.selectLatestAdded
657 expect "Default color of XLink", map.getXLinkColor, "#ff0000"
658 expect "Default width of XLink", map.getXLinkWidth.to_i, 2
659 expect "Default style of XLink", map.getXLinkPenStyle, "Qt::DashDotLine"
660 expect "Default style of XLink begin", map.getXLinkStyleBegin, "HeadFull"
661 expect "Default style of XLink end", map.getXLinkStyleEnd, "HeadFull"
664 expect "New width of XLink", map.getXLinkWidth.to_i, 3
666 expect "Undo width of XLink", map.getXLinkWidth.to_i, 2
668 map.setXLinkColor("#00ff00")
669 expect "New color of XLink", map.getXLinkColor, "#00ff00"
671 expect "Undo color of XLink", map.getXLinkColor, "#ff0000"
673 map.setXLinkStyle("Qt::SolidLine")
674 expect "New style of XLink", map.getXLinkPenStyle, "Qt::SolidLine"
676 expect "Undo style of XLink", map.getXLinkPenStyle, "Qt::DashDotLine"
678 map.setXLinkStyleBegin("None")
679 expect "New style of XLink begin", map.getXLinkStyleBegin, "None"
681 expect "Undo style of XLink begin", map.getXLinkStyleBegin, "HeadFull"
683 map.setXLinkStyleEnd("None")
684 expect "New style of XLink end", map.getXLinkStyleEnd, "None"
686 expect "Undo style of XLink end", map.getXLinkStyleEnd, "HeadFull"
691 #######################
694 map = init_map( vym )
696 expect "Branch has no task before test", map.hasTask, false
698 expect "Toggle task", map.hasTask, true
700 date_today = DateTime.now
702 date_later = date_today + delta_days
703 date_later_iso = date_later.strftime("%Y-%m-%dT%H:%M:%S")
705 # Input: number of days
706 date_new = delta_days
707 expect "Set task sleep to number of days '#{date_new}' accepts input", map.setTaskSleep(date_new), true
708 expect "Set task sleep to number of days '#{date_new}' has correct sleep value '#{delta_days}' days", map.getTaskSleepDays.to_i, delta_days
710 # Input: number of seconds
712 expect "Set task sleep to number of seconds '#{date_new}' accepts input", map.setTaskSleep(date_new), true
714 # Input: number of hours
716 expect "Set task sleep to number of hours '#{date_new}' accepts input", map.setTaskSleep(date_new), true
719 date_new = date_later.strftime("%Y-%m-%d")
720 expect "Set task sleep to ISO Date '#{date_new}' accepts input", map.setTaskSleep(date_new), true
721 expect "Set task sleep to ISO Date '#{date_new}' has correct sleep value '#{delta_days}' days", map.getTaskSleepDays.to_i, delta_days
723 date_new = date_later.strftime("%d.%m.")
724 expect "Set task sleep to German short form '#{date_new}' accepts input '#{date_new}'", map.setTaskSleep(date_new), true
725 expect "Set task sleep to German short form '#{date_new}' has correct sleep value (days)", map.getTaskSleepDays.to_i, delta_days
727 date_new = date_later.strftime("%d.%m.%Y")
728 expect "Set task sleep to German long form '#{date_new}' accepts input '#{date_new}'", map.setTaskSleep(date_new), true
729 expect "Set task sleep to German long form '#{date_new}' has correct sleep value (days)", map.getTaskSleepDays.to_i, delta_days
731 # Input: Invalid strings
732 date_new = "invalidDate"
733 expect "Set task sleep to '#{date_new}' should fail", map.setTaskSleep(date_new), false
735 date_new = date_later.strftime("%d %m.%Y")
736 expect "Set task sleep to '#{date_new}' should fail", map.setTaskSleep(date_new), false
739 date_new = date_later_iso
740 expect "Set task sleep to ISO DateTime '#{date_new}' accepts input", map.setTaskSleep(date_new), true
741 expect "Set task sleep to ISO DateTime '#{date_new}' returns correct sleep value '#{date_later_iso}'", map.getTaskSleep, date_later_iso
744 date_later = date_today
747 date_later_iso = date_today.strftime("%Y-%m-%dT12:34:00")
748 expect "Set task sleep to time '#{date_new}' accepts input", map.setTaskSleep(date_new), true
749 expect "Set task sleep to time '#{date_new}' returns correct sleep value '#{date_later_iso}'",
750 map.getTaskSleep, date_later_iso
753 date_later_iso = date_today.strftime("%Y-%m-%dT02:04:00")
754 expect "Set task sleep to time '#{date_new}' accepts input", map.setTaskSleep(date_new), true
755 expect "Set task sleep to time '#{date_new}' returns correct sleep value '#{date_later_iso}'",
756 map.getTaskSleep, date_later_iso
759 date_later_iso = date_today.strftime("%Y-%m-%dT03:05:00")
760 expect "Set task sleep to time '#{date_new}' accepts input", map.setTaskSleep(date_new), true
761 expect "Set task sleep to time '#{date_new}' returns correct sleep value '#{date_later_iso}'",
762 map.getTaskSleep, date_later_iso
765 ######################
769 # Plaintext notes basic actions
770 map = init_map( vym )
772 note_plain = "vymnote plaintext"
773 map.setNotePlainText(note_plain)
774 expect "Set note to \"#{note_plain}\". Still plaintext?", map.hasRichTextNote, false
777 expect "After reselect, is note plaintext?", map.hasRichTextNote, false
779 note_plain = "<b>plaintext, not bold!</b>"
780 map.setNotePlainText(note_plain)
781 expect "Set note to plaintext containing html tags. Still plaintext", map.hasRichTextNote, false
782 note_new = map.getNotePlainText
785 expect "After reselect, is note text unchanged?", map.getNotePlainText, note_new
786 expect "After reselect, is note plaintext?", map.hasRichTextNote, false
788 # Plaintext notes copy & paste
791 map.selectLastChildBranch
792 s=map.getSelectionString
793 expect "After copy& paste: New note unchanged?", map.getNotePlainText, note_plain
794 expect "After copy& paste: New note Still plaintext?", map.hasRichTextNote, false
797 # Plaintext notes undo & redo
799 map.setNotePlainText('Foobar')
801 expect "Undo after setNotePlainText restores previous note", map.getNotePlainText, note_plain
804 expect "Redo restores previous note", map.getNotePlainText, 'Foobar'
806 # Plaintext notes load & save
807 note_org = IO.read('test/note-plain.txt')
808 map.loadNote("test/note-plain.txt")
809 expect "Load plain text note from file. Still plaintext?", map.hasRichTextNote, false
810 expect "Note contains 'not bold'", map.getNotePlainText.include?("not bold"), true
811 filepath = "#{@testdir}/save-note.txt"
812 map.saveNote(filepath)
813 expect "Save note to file. Check if it contains 'textMode=\"plainText\"'", IO.read(filepath).include?("textMode=\"plainText\""), true
814 expect "Save note to file. Check if it contains 'not bold'", IO.read(filepath).include?("not bold"), true
815 expect "Save note to file. Check new format: no longer contains '<b>' element", IO.read(filepath).include?("<b>"), false
816 expect "Save note to file. Check new format: no longer contains '<![CDATA['", IO.read(filepath).include?("<![CDATA["), false
817 expect "Save note to file. Check new format: contains 'text=\"Plaintext'", IO.read(filepath).include?("text=\"Plaintext"), true
820 map.setNotePlainText("")
821 expect "setNotePlainText(\"\") deletes note", map.hasNote, false
823 # RichText basic actions
824 map = init_map( vym )
826 rt_note = '<vymnote textMode="richText"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:"Arial"; font-size:12pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:"DejaVu Sans Mono"; color:#000000;">Rich Text note with <b>not bold text</b></span></p></body></html>]]></vymnote>'
827 map.parseVymText(rt_note)
828 expect "parseVymText of richText note produces note", map.hasNote, true
829 expect "parseVymText of richText note produces richText note", map.hasRichTextNote, true
832 expect "After reselect, is note RichText?", map.hasRichTextNote, true
835 # RichText notes copy & paste
836 rt_note = map.getNoteXML
839 map.selectLastChildBranch
840 s = map.getSelectionString
841 expect "After copy & paste: New note Still RichText?", map.hasRichTextNote, true
842 expect "After copy & paste: New note unchanged?", map.getNoteXML, rt_note
845 # RichText notes undo & redo
847 map.setNotePlainText('Foobar')
849 expect "Undo after setNotePlainText restores RichText note", map.getNoteXML, rt_note
852 expect "Redo restores previous plaintext note", map.getNotePlainText, 'Foobar'
854 # RichText notes load & save
855 map.loadNote("test/note.html")
856 expect "Load HTML note from file and try to detect textMode. Is RichText?", map.hasRichTextNote, true
857 filepath = "#{@testdir}/save-note.txt"
858 map.saveNote(filepath)
859 expect "Save note to file. Check if it contains 'textMode=\"richText\"'", IO.read(filepath).include?("textMode=\"richText\""), true
860 expect "Save note to file. Check if it contains 'bold'", IO.read(filepath).include?("bold"), true
861 expect "Save note to file. Check new format: no longer contains '<b>' element", IO.read(filepath).include?("<b>"), false
862 expect "Save note to file. Check new format: no longer contains '<![CDATA['", IO.read(filepath).include?("<![CDATA["), false
863 expect "Save note to file. Check new format: contains 'text=\"<'", IO.read(filepath).include?("text=\"<"), true
866 map.setNotePlainText("")
867 expect "setNotePlainText(\"\") deletes note", map.hasNote, false
869 # Compatibility with version < 2.5.0 # FIXME missing
872 def test_headings (vym)
874 # FIXME same checks like for notes above for headings
877 ######################
878 def test_bugfixes (vym)
880 map = init_map( vym )
882 expect "Mapcenter of #{@center_1} has no frame", map.getFrameType, "NoFrame"
885 #######################
906 relinkTo (for images)
914 setFrameIncludeChildren
920 setHideLinksUnselected
921 setIncludeImagesHorizontally
922 setIncludeImagesVertically
925 setMapBackgroundColor
938 toggleFrameIncludeChildren
946 OptionParser.new do |opts|
947 opts.banner = "Usage: vym-test.rb [options]"
949 opts.on('-d', '--directory NAME', 'Directory name') { |s| options[:testdir] = s }
952 @testdir = options[:testdir]
960 #######################
964 @branch_a=@main_a+",bo:0"
965 @branch_b=@main_a+",bo:1"
966 @branch_c=@main_a+",bo:2"
971 instance_name = 'test'
973 vym_mgr = VymManager.new
974 #vym_mgr.show_running
976 vym = vym_mgr.find(instance_name)
979 puts "Couldn't find instance name \"#{instance_name}\", please start one:"
980 puts "vym -l -n \"#{instance-name}\" -t test/default.vym"
988 test_adding_branches(vym)
989 test_adding_maps(vym)
991 test_moving_parts(vym)
992 test_modify_branches(vym)
994 test_delete_parts(vym)