rabbit 2.2.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +5 -5
  2. data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
  3. data/doc/_config.yml +2 -2
  4. data/doc/_layouts/en.html +1 -1
  5. data/doc/_layouts/ja.html +1 -1
  6. data/doc/en/news.rd +140 -0
  7. data/doc/en/sample/hiki/rabbit.hiki +2 -2
  8. data/doc/en/sample/markdown/rabbit.md +1 -1
  9. data/doc/en/sample/rd/rabbit.rd +1 -1
  10. data/doc/en/usage/rabbit-slide.rd +3 -3
  11. data/doc/images/screenshots/en/blue-circle-raw.png +0 -0
  12. data/doc/images/screenshots/en/blue-circle.png +0 -0
  13. data/doc/images/screenshots/en/clear-blue-raw.png +0 -0
  14. data/doc/images/screenshots/en/clear-blue.png +0 -0
  15. data/doc/images/screenshots/en/cozmixng-raw.png +0 -0
  16. data/doc/images/screenshots/en/cozmixng.png +0 -0
  17. data/doc/images/screenshots/en/dark-gradation-raw.png +0 -0
  18. data/doc/images/screenshots/en/dark-gradation.png +0 -0
  19. data/doc/images/screenshots/en/day-white-raw.png +0 -0
  20. data/doc/images/screenshots/en/day-white.png +0 -0
  21. data/doc/images/screenshots/en/debian-raw.png +0 -0
  22. data/doc/images/screenshots/en/debian.png +0 -0
  23. data/doc/images/screenshots/en/green-circle-raw.png +0 -0
  24. data/doc/images/screenshots/en/green-circle.png +0 -0
  25. data/doc/images/screenshots/en/night-black-raw.png +0 -0
  26. data/doc/images/screenshots/en/night-black.png +0 -0
  27. data/doc/images/screenshots/en/rabbit-raw.png +0 -0
  28. data/doc/images/screenshots/en/rabbit.png +0 -0
  29. data/doc/images/screenshots/en/ranguba-raw.png +0 -0
  30. data/doc/images/screenshots/en/ranguba.png +0 -0
  31. data/doc/images/screenshots/en/red-frame-raw.png +0 -0
  32. data/doc/images/screenshots/en/red-frame.png +0 -0
  33. data/doc/images/screenshots/en/ruby-gnome2-raw.png +0 -0
  34. data/doc/images/screenshots/en/ruby-gnome2.png +0 -0
  35. data/doc/images/screenshots/en/rubykaigi2011-raw.png +0 -0
  36. data/doc/images/screenshots/en/rubykaigi2011.png +0 -0
  37. data/doc/images/screenshots/ja/blue-circle-raw.png +0 -0
  38. data/doc/images/screenshots/ja/blue-circle.png +0 -0
  39. data/doc/images/screenshots/ja/clear-blue-raw.png +0 -0
  40. data/doc/images/screenshots/ja/clear-blue.png +0 -0
  41. data/doc/images/screenshots/ja/cozmixng-raw.png +0 -0
  42. data/doc/images/screenshots/ja/cozmixng.png +0 -0
  43. data/doc/images/screenshots/ja/dark-gradation-raw.png +0 -0
  44. data/doc/images/screenshots/ja/dark-gradation.png +0 -0
  45. data/doc/images/screenshots/ja/day-white-raw.png +0 -0
  46. data/doc/images/screenshots/ja/day-white.png +0 -0
  47. data/doc/images/screenshots/ja/debian-raw.png +0 -0
  48. data/doc/images/screenshots/ja/debian.png +0 -0
  49. data/doc/images/screenshots/ja/green-circle-raw.png +0 -0
  50. data/doc/images/screenshots/ja/green-circle.png +0 -0
  51. data/doc/images/screenshots/ja/night-black-raw.png +0 -0
  52. data/doc/images/screenshots/ja/night-black.png +0 -0
  53. data/doc/images/screenshots/ja/rabbit-raw.png +0 -0
  54. data/doc/images/screenshots/ja/rabbit.png +0 -0
  55. data/doc/images/screenshots/ja/ranguba-raw.png +0 -0
  56. data/doc/images/screenshots/ja/ranguba.png +0 -0
  57. data/doc/images/screenshots/ja/red-frame-raw.png +0 -0
  58. data/doc/images/screenshots/ja/red-frame.png +0 -0
  59. data/doc/images/screenshots/ja/ruby-gnome2-raw.png +0 -0
  60. data/doc/images/screenshots/ja/ruby-gnome2.png +0 -0
  61. data/doc/images/screenshots/ja/rubykaigi2011-raw.png +0 -0
  62. data/doc/images/screenshots/ja/rubykaigi2011.png +0 -0
  63. data/doc/ja/how-to-make/index.rd +1 -1
  64. data/doc/ja/news.rd +143 -0
  65. data/doc/ja/sample/hiki/rabbit.hiki +2 -2
  66. data/doc/ja/sample/markdown/rabbit.md +1 -1
  67. data/doc/ja/sample/rd/rabbit.rd +1 -1
  68. data/doc/ja/slides.rd +1 -1
  69. data/doc/ja/usage/rabbit-slide.rd +3 -3
  70. data/doc/ja/users.rd +1 -1
  71. data/lib/rabbit/action.rb +23 -4
  72. data/lib/rabbit/canvas.rb +70 -14
  73. data/lib/rabbit/command/rabbit-slide.rb +252 -67
  74. data/lib/rabbit/command/rabbit-slide.ui +180 -0
  75. data/lib/rabbit/command/rabbit.rb +14 -20
  76. data/lib/rabbit/console.rb +9 -3
  77. data/lib/rabbit/dependency-canvas.rb +19 -1
  78. data/lib/rabbit/element.rb +34 -7
  79. data/lib/rabbit/element/poppler-page.rb +1 -2
  80. data/lib/rabbit/element/text-container-element.rb +2 -2
  81. data/lib/rabbit/element/text-renderer.rb +5 -4
  82. data/lib/rabbit/element/title-slide.rb +8 -0
  83. data/lib/rabbit/element/video.rb +1 -2
  84. data/lib/rabbit/filename.rb +39 -0
  85. data/lib/rabbit/formatter.rb +61 -30
  86. data/lib/rabbit/frame.rb +1 -19
  87. data/lib/rabbit/front.rb +23 -2
  88. data/lib/rabbit/gesture/handler.rb +21 -2
  89. data/lib/rabbit/graffiti/config-dialog.rb +15 -18
  90. data/lib/rabbit/gtk.rb +2 -191
  91. data/lib/rabbit/html/generator.rb +38 -30
  92. data/lib/rabbit/image-data-loader.rb +6 -1
  93. data/lib/rabbit/image.rb +22 -4
  94. data/lib/rabbit/image/base.rb +34 -2
  95. data/lib/rabbit/image/default.rb +1 -1
  96. data/lib/rabbit/image/eps.rb +1 -1
  97. data/lib/rabbit/image/gimp.rb +1 -1
  98. data/lib/rabbit/info-window.rb +27 -15
  99. data/lib/rabbit/logger/gui.rb +21 -23
  100. data/lib/rabbit/logger/stderr.rb +1 -1
  101. data/lib/rabbit/pango-markup.rb +44 -0
  102. data/lib/rabbit/parser.rb +20 -3
  103. data/lib/rabbit/parser/ext/image.rb +25 -8
  104. data/lib/rabbit/parser/ext/video.rb +21 -2
  105. data/lib/rabbit/parser/markdown.rb +1 -2
  106. data/lib/rabbit/parser/pdf.rb +23 -7
  107. data/lib/rabbit/parser/rd/rd2rabbit-lib.rb +20 -0
  108. data/lib/rabbit/progress.rb +34 -23
  109. data/lib/rabbit/renderer.rb +17 -23
  110. data/lib/rabbit/renderer/base.rb +31 -57
  111. data/lib/rabbit/renderer/color.rb +46 -53
  112. data/lib/rabbit/renderer/display/base.rb +71 -62
  113. data/lib/rabbit/renderer/display/button-handler.rb +2 -1
  114. data/lib/rabbit/renderer/display/clutter-embed.rb +60 -26
  115. data/lib/rabbit/renderer/display/drawing-area-base.rb +1 -1
  116. data/lib/rabbit/renderer/display/drawing-area-primitive.rb +34 -21
  117. data/lib/rabbit/renderer/display/graffiti.rb +1 -3
  118. data/lib/rabbit/renderer/display/hook-handler.rb +8 -4
  119. data/lib/rabbit/renderer/display/key-handler.rb +7 -2
  120. data/lib/rabbit/renderer/display/magnifier.rb +2 -2
  121. data/lib/rabbit/renderer/display/progress.rb +10 -2
  122. data/lib/rabbit/renderer/display/spotlight.rb +2 -2
  123. data/lib/rabbit/renderer/engine/cairo.rb +0 -3
  124. data/lib/rabbit/renderer/kernel.rb +54 -0
  125. data/lib/rabbit/renderer/offscreen.rb +14 -6
  126. data/lib/rabbit/renderer/print-layout.rb +150 -0
  127. data/lib/rabbit/renderer/printer.rb +236 -0
  128. data/lib/rabbit/renderer/screen.rb +288 -0
  129. data/lib/rabbit/renderer/widget/drawing-area.rb +93 -0
  130. data/lib/rabbit/size.rb +52 -25
  131. data/lib/rabbit/slide-configuration.rb +56 -12
  132. data/lib/rabbit/source.rb +24 -8
  133. data/lib/rabbit/task/slide.rb +1 -1
  134. data/lib/rabbit/theme/applier.rb +26 -9
  135. data/lib/rabbit/theme/base/base.rb +7 -7
  136. data/lib/rabbit/theme/clear-blue/clear-blue.rb +1 -1
  137. data/lib/rabbit/theme/image-timer/image-timer.rb +3 -1
  138. data/lib/rabbit/theme/image-viewer/image-viewer.rb +13 -1
  139. data/lib/rabbit/theme/image/image.rb +4 -4
  140. data/lib/rabbit/theme/lightning-talk-toolkit/lightning-talk-toolkit.rb +3 -1
  141. data/lib/rabbit/theme/tag/tag.rb +12 -4
  142. data/lib/rabbit/version.rb +2 -2
  143. data/lib/rabbit/video-window.rb +75 -89
  144. data/misc/emacs/rabbit-mode.el +11 -7
  145. data/po/en/rabbit.edit.po +189 -185
  146. data/po/en/rabbit.po +15 -12
  147. data/po/fr/rabbit.edit.po +189 -185
  148. data/po/fr/rabbit.po +15 -12
  149. data/po/ja/rabbit.edit.po +190 -186
  150. data/po/ja/rabbit.po +16 -13
  151. data/rabbit.gemspec +34 -16
  152. data/test/command/test-rabbit.rb +100 -0
  153. data/test/{rabbit-test-utils.rb → helper.rb} +7 -4
  154. data/test/{rabbit-test-utils → helper}/fixture.rb +2 -2
  155. data/test/{rabbit-test-utils → helper}/parser.rb +2 -2
  156. data/test/image/test-dia.rb +2 -2
  157. data/test/image/test-eps.rb +2 -2
  158. data/test/parser/test-markdown.rb +3 -5
  159. data/test/parser/test-rd.rb +1 -3
  160. data/test/parser/test-wiki.rb +3 -5
  161. data/test/run-test.rb +3 -3
  162. data/test/test-applier.rb +60 -29
  163. data/test/test-canvas.rb +70 -0
  164. data/test/test-color.rb +18 -9
  165. data/test/test-element.rb +15 -3
  166. data/test/test-size.rb +25 -22
  167. data/test/test-slide-configuration.rb +16 -6
  168. data/test/test-source.rb +15 -5
  169. data/test/test-utils.rb +15 -1
  170. metadata +55 -84
  171. data/lib/rabbit/renderer/print.rb +0 -31
  172. data/lib/rabbit/renderer/print/base.rb +0 -78
  173. data/lib/rabbit/renderer/print/cairo.rb +0 -122
  174. data/lib/rabbit/renderer/print/layout.rb +0 -123
  175. data/lib/rabbit/renderer/print/multiple.rb +0 -202
  176. data/lib/rabbit/source/hiki.rb +0 -36
  177. data/lib/rabbit/source/slide-share.rb +0 -53
@@ -6,7 +6,7 @@ msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: Rabbit 0.5.4\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
- "PO-Revision-Date: 2016-11-19 10:38+0900\n"
9
+ "PO-Revision-Date: 2019-09-06 06:24+0900\n"
10
10
  "Last-Translator: Kouhei Sutou <kou@cozmixng.org>\n"
11
11
  "Language-Team: Kouhei Sutou <kou@cozmixng.org> and Kobayashi Noritada <nori1@d"
12
12
  "olphin.c.u-tokyo.ac.jp>\n"
@@ -336,6 +336,12 @@ msgstr " new: 新しいスライドを作成"
336
336
  msgid " change: change an existing slide"
337
337
  msgstr " change: 既存のスライドを変更"
338
338
 
339
+ msgid "User interface"
340
+ msgstr "ユーザーインターフェイス"
341
+
342
+ msgid "Don't use GUI"
343
+ msgstr "GUIを使わない"
344
+
339
345
  msgid "Slide information"
340
346
  msgstr "スライドの情報"
341
347
 
@@ -369,6 +375,9 @@ msgstr "新しいスライドのタイトル"
369
375
  msgid "--title=\"Rabbit Introduction\""
370
376
  msgstr "--title=\"Rabbitの紹介\""
371
377
 
378
+ msgid "License of the new slide"
379
+ msgstr "新しいスライドのライセンス"
380
+
372
381
  msgid "Tags of the new slide"
373
382
  msgstr "新しいスライドのタグ"
374
383
 
@@ -378,6 +387,12 @@ msgstr "プレゼンの持ち時間"
378
387
  msgid "Presentation date with the new slide"
379
388
  msgstr "新しいスライドでプレゼンする日"
380
389
 
390
+ msgid "Presentation start time"
391
+ msgstr ""
392
+
393
+ msgid "Presentation end time"
394
+ msgstr ""
395
+
381
396
  msgid "Your information"
382
397
  msgstr "あなたの情報"
383
398
 
@@ -749,12 +764,6 @@ msgstr "3D"
749
764
  msgid "Specify whether to use OpenGL if available."
750
765
  msgstr "可能ならOpenGLを使うかどうかを指定します."
751
766
 
752
- msgid "Display"
753
- msgstr "画面表示"
754
-
755
- msgid "Specify whether to keep above window."
756
- msgstr "ウィンドウを常に前面に表示するかどうかを指定します。"
757
-
758
767
  msgid "Others"
759
768
  msgstr "その他"
760
769
 
@@ -1027,15 +1036,9 @@ msgstr ""
1027
1036
  msgid "[FILENAME]"
1028
1037
  msgstr "[ファイル名]"
1029
1038
 
1030
- msgid "[HIKI_CGI_URI] and [PAGE_NAME]"
1031
- msgstr "[HikiのCGIのURI]と[ページ名]"
1032
-
1033
1039
  msgid "[FILENAME_OR_NOT]"
1034
1040
  msgstr "[ファイル名か何も指定しない]"
1035
1041
 
1036
- msgid "[USER] and [TITLE]"
1037
- msgstr "[USER]と[TITLE]"
1038
-
1039
1042
  msgid "URI"
1040
1043
  msgstr "URI"
1041
1044
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2017 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2012-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,24 +14,45 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
- base_dir = File.expand_path(File.dirname(__FILE__))
18
- $LOAD_PATH.unshift(File.join(base_dir, 'lib'))
19
- require "rabbit/version"
17
+ require_relative "lib/rabbit/version"
20
18
 
21
19
  Gem::Specification.new do |spec|
22
20
  spec.name = "rabbit"
23
21
  spec.version = Rabbit::VERSION.dup
24
- spec.rubyforge_project = "rabbit"
25
22
  spec.homepage = "http://rabbit-shocker.org/"
26
23
  spec.authors = ["Kouhei Sutou"]
27
24
  spec.email = ["kou@cozmixng.org"]
28
- spec.summary = 'Rabbit is an RD-document-based presentation application.'
29
- spec.description = spec.summary # FIXME
25
+ spec.summary = "Rabbit is a presentation tool for Rubyist"
26
+ normalize_new_lines = lambda do |text|
27
+ paragraphs = text.split("\n\n").collect do |paragraph|
28
+ paragraph.gsub("\n", "")
29
+ end
30
+ paragraphs.join("\n\n")
31
+ end
32
+ spec.description = normalize_new_lines.call(<<-DESCRIPTION)
33
+ You can create your slide as a text file. It means that you can version control
34
+ your slide like your Ruby scripts. You can custom your slide style by Ruby.
35
+ So Rabbit is for Rubyist.
36
+
37
+ You can use RD, Markdown and Wiki format as slide source.
38
+
39
+ Rabbit provides programmer friendly keyboard interface. It uses Emacs and Vi
40
+ style keybindings by default.
41
+
42
+ You can use PDF and image as slide source. Rabbit can show PDF and image
43
+ directly. You can create your slide by other presentation tool and show your
44
+ slide by Rabbit. If you show your slide by Rabbit, you can use programmer
45
+ friendly keyboard interface provided by Rabbit to control your slide.
46
+
47
+ You can upload your slide as a gem. If you publish your slide as a gem, you
48
+ can see your slide at https://slide.rabbit-shocker.org/ .
49
+ DESCRIPTION
30
50
  spec.license = "GPLv2+"
31
51
 
32
52
  spec.files = ["Rakefile", "COPYING", "GPL", "README", "Gemfile"]
33
53
  spec.files += ["#{spec.name}.gemspec"]
34
- spec.files += Dir.glob("{lib,data,entities,sample,misc,doc}/**/*")
54
+ spec.files += Dir.glob("lib/**/*.{rb,erb,ui}")
55
+ spec.files += Dir.glob("{data,entities,sample,misc,doc}/**/*")
35
56
  spec.files += Dir.glob("po/*/*.po")
36
57
  spec.files -= Dir.glob("doc/_site/**/*")
37
58
  spec.files += Dir.glob("*.rb")
@@ -43,29 +64,26 @@ Gem::Specification.new do |spec|
43
64
  spec.executables = Dir.glob("*")
44
65
  end
45
66
 
46
- spec.required_ruby_version = ">= 2.1.0"
67
+ spec.required_ruby_version = ">= 2.4.0"
47
68
 
48
- spec.add_runtime_dependency("gio2")
49
69
  spec.add_runtime_dependency("gdk_pixbuf2", ">= 3.0.9")
50
- spec.add_runtime_dependency("gtk2")
70
+ spec.add_runtime_dependency("gtk3")
51
71
  spec.add_runtime_dependency("rsvg2", ">= 3.1.4")
52
- spec.add_runtime_dependency("poppler")
72
+ spec.add_runtime_dependency("poppler", ">= 3.2.5")
53
73
  spec.add_runtime_dependency("hikidoc")
54
74
  spec.add_runtime_dependency("nokogiri")
55
75
  spec.add_runtime_dependency("rdtool")
56
76
  spec.add_runtime_dependency("rttool")
57
77
  spec.add_runtime_dependency("coderay", ">= 1.0.0")
58
- spec.add_runtime_dependency("kramdown")
78
+ spec.add_runtime_dependency("kramdown-parser-gfm")
59
79
  spec.add_runtime_dependency("gettext", ">= 3.0.1")
60
80
  spec.add_runtime_dependency("faraday")
61
81
  # spec.add_runtime_dependency("gstreamer")
62
82
  spec.add_runtime_dependency("rouge")
63
83
 
64
- spec.add_development_dependency("gtk3")
65
84
  spec.add_development_dependency("test-unit")
66
- spec.add_development_dependency("test-unit-notify")
67
85
  spec.add_development_dependency("test-unit-rr")
68
86
  spec.add_development_dependency("rake")
69
87
  spec.add_development_dependency("bundler")
70
- spec.add_development_dependency("jekyll", ">= 1.0.2")
88
+ spec.add_development_dependency("jekyll")
71
89
  end
@@ -0,0 +1,100 @@
1
+ # Copyright (C) 2018-2019 Kouhei Sutou <kou@cozmixng.org>
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation; either version 2 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License along
14
+ # with this program; if not, write to the Free Software Foundation, Inc.,
15
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
+
17
+ class RabbitCommandRabbitTest < Test::Unit::TestCase
18
+ def setup
19
+ @base_dir = File.expand_path(File.join(__dir__, "..", ".."))
20
+ @dir = Dir.mktmpdir
21
+ end
22
+
23
+ def teardown
24
+ FileUtils.rm_rf(@dir)
25
+ end
26
+
27
+ def rabbit(*arguments)
28
+ Dir.chdir(@dir) do
29
+ pid = spawn({
30
+ "LANG" => "C",
31
+ },
32
+ RbConfig.ruby,
33
+ "-I", File.join(@base_dir, "lib"),
34
+ File.join(@base_dir, "bin", "rabbit"),
35
+ *arguments,
36
+ {
37
+ :out => "stdout",
38
+ :err => "stderr",
39
+ })
40
+ _, status = Process.waitpid2(pid)
41
+ return status.success?, File.read("stdout"), File.read("stderr")
42
+ end
43
+ end
44
+
45
+ test("--save-as-image") do
46
+ File.open(File.join(@dir, "slide.rab"), "w") do |slide|
47
+ slide.puts(<<-'SLIDE')
48
+ = ス\nラ/イ\ド:タイトル
49
+
50
+ = ページタイトル
51
+ SLIDE
52
+ end
53
+ success, stdout, stderr = rabbit("--save-as-image", "slide.rab")
54
+ Dir.chdir(@dir) do
55
+ assert_equal([
56
+ true,
57
+ "",
58
+ "[INFO]\nCreating a image for the 0th page\n" +
59
+ "[INFO]\nCreating a image for the 1th page\n",
60
+ [
61
+ "スラ-イ-ド-タイトル-0.png",
62
+ "スラ-イ-ド-タイトル-1.png",
63
+ ],
64
+ ],
65
+ [
66
+ success,
67
+ stdout,
68
+ stderr,
69
+ Dir.glob("*.png").sort,
70
+ ])
71
+ end
72
+ end
73
+
74
+ test("--print") do
75
+ File.open(File.join(@dir, "slide.rab"), "w") do |slide|
76
+ slide.puts(<<-'SLIDE')
77
+ = ス\nラ/イ\ド:タイトル
78
+
79
+ = ページタイトル
80
+ SLIDE
81
+ end
82
+ success, stdout, stderr = rabbit("--print", "slide.rab")
83
+ Dir.chdir(@dir) do
84
+ assert_equal([
85
+ true,
86
+ "",
87
+ "",
88
+ [
89
+ "スラ-イ-ド-タイトル.pdf",
90
+ ],
91
+ ],
92
+ [
93
+ success,
94
+ stdout,
95
+ stderr,
96
+ Dir.glob("*.pdf").sort,
97
+ ])
98
+ end
99
+ end
100
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2004-2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2004-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,9 +14,12 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
+ require "fileutils"
18
+ require "rbconfig"
19
+ require "tmpdir"
20
+
17
21
  require "test-unit"
18
- require "test/unit/notify"
19
22
  require "test/unit/rr"
20
23
 
21
- require "rabbit-test-utils/fixture"
22
- require "rabbit-test-utils/parser"
24
+ require "helper/fixture"
25
+ require "helper/parser"
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2012-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
- module RabbitTestUtils
17
+ module Helper
18
18
  module Fixture
19
19
  private
20
20
  def fixture_path(*components)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2014-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
- module RabbitTestUtils
17
+ module Helper
18
18
  module Parser
19
19
  private
20
20
  def parse(parser_class, text)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2012-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
17
17
  require "rabbit/image/dia"
18
18
 
19
19
  class TestImageDia < Test::Unit::TestCase
20
- include RabbitTestUtils::Fixture
20
+ include Helper::Fixture
21
21
 
22
22
  private
23
23
  def fixture_path(base_name)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2012-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
17
17
  require "rabbit/image/eps"
18
18
 
19
19
  class TestImageEPS < Test::Unit::TestCase
20
- include RabbitTestUtils::Fixture
20
+ include Helper::Fixture
21
21
 
22
22
  private
23
23
  def fixture_path(base_name)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2017 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2014-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,16 +14,14 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
- require "rabbit-test-utils"
18
-
19
17
  require "rabbit/logger"
20
18
  require "rabbit/slide"
21
19
  require "rabbit/source/memory"
22
20
  require "rabbit/parser/markdown"
23
21
 
24
22
  class RabbitParserMarkdownTest < Test::Unit::TestCase
25
- include RabbitTestUtils::Fixture
26
- include RabbitTestUtils::Parser
23
+ include Helper::Fixture
24
+ include Helper::Parser
27
25
 
28
26
  private
29
27
  def parse(markdown)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2014-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,8 +14,6 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
- require "rabbit-test-utils"
18
-
19
17
  require "rabbit/slide"
20
18
  require "rabbit/source/memory"
21
19
  require "rabbit/parser/rd"
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2015-2019 Kouhei Sutou <kou@cozmixng.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,16 +14,14 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
- require "rabbit-test-utils"
18
-
19
17
  require "rabbit/logger"
20
18
  require "rabbit/slide"
21
19
  require "rabbit/source/memory"
22
20
  require "rabbit/parser/wiki"
23
21
 
24
22
  class RabbitParserWikiTest < Test::Unit::TestCase
25
- include RabbitTestUtils::Fixture
26
- include RabbitTestUtils::Parser
23
+ include Helper::Fixture
24
+ include Helper::Parser
27
25
 
28
26
  private
29
27
  def parse(wiki_text)
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2004-2013 Kouhei Sutou <kou@cozmixng.org>
3
+ # Copyright (C) 2004-2019 Kouhei Sutou <kou@cozmixng.org>
4
4
  #
5
5
  # This program is free software; you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License as published by
@@ -22,6 +22,6 @@ test_dir = File.join(base_dir, "test")
22
22
  $LOAD_PATH.unshift(File.join(base_dir, "lib"))
23
23
  $LOAD_PATH.unshift(test_dir)
24
24
 
25
- require "rabbit-test-utils"
25
+ require_relative "helper"
26
26
 
27
- exit Test::Unit::AutoRunner.run(true, test_dir)
27
+ exit(Test::Unit::AutoRunner.run(true, test_dir))
@@ -1,42 +1,73 @@
1
- require 'fileutils'
2
-
3
- require "rabbit-test-utils"
1
+ # Copyright (C) 2012-2019 Kouhei Sutou <kou@cozmixng.org>
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation; either version 2 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License along
14
+ # with this program; if not, write to the Free Software Foundation, Inc.,
15
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4
16
 
5
17
  require "rabbit/theme/applier"
6
18
 
7
19
  class RabbitApplierTest < Test::Unit::TestCase
8
- def test_normalize_source
9
- assert_normalize_source_ivar("x_large_font_size", "huge_font_size")
10
- assert_normalize_source_ivar("xx_large_font_size", "very_huge_font_size")
11
- assert_normalize_source_ivar("x_large_script_font_size",
12
- "huge_script_font_size")
13
- end
14
-
15
- def normalize_source(src)
16
- dummy = Object.new
17
- def dummy.slides
20
+ def setup
21
+ theme = Object.new
22
+ def theme.slides
18
23
  Object.new
19
24
  end
20
- Rabbit::Theme::Applier.new(dummy).__send__(:normalize_source, src)
25
+ @applier = Rabbit::Theme::Applier.new(theme)
21
26
  end
22
27
 
23
- def assert_normalize_source(expected, src)
24
- _wrap_assertion do
25
- assert_equal(expected, normalize_source(src))
28
+ sub_test_case("#normalize_source") do
29
+ def normalize_source(source)
30
+ @applier.__send__(:normalize_source, source)
31
+ end
32
+
33
+ data("x large",
34
+ ["x_large_font_size", "huge_font_size"],
35
+ keep: true)
36
+ data("xx large",
37
+ ["xx_large_font_size", "very_huge_font_size"],
38
+ keep: true)
39
+ data("x large script",
40
+ ["x_large_script_font_size", "huge_script_font_size"],
41
+ keep: true)
42
+
43
+ def test_reference
44
+ after, before = data
45
+ assert_equal("@#{after}",
46
+ normalize_source("@#{before}"))
47
+ end
48
+
49
+ def test_reference_in_parentheses
50
+ after, before = data
51
+ assert_equal("(@#{after})",
52
+ normalize_source("(@#{before})"))
53
+ end
54
+
55
+ def test_reference_with_arguments_in_parentheses
56
+ after, before = data
57
+ assert_equal("(xxx, @#{after}, xxx)",
58
+ normalize_source("(xxx, @#{before}, xxx)"))
59
+ end
60
+
61
+ def test_assign_without_space
62
+ after, before = data
63
+ assert_equal("@#{after}=111",
64
+ normalize_source("@#{before}=111"))
26
65
  end
27
- end
28
66
 
29
- def assert_normalize_source_ivar(after, before)
30
- _wrap_assertion do
31
- assert_normalize_source("@#{after}", "@#{before}")
32
- assert_normalize_source("@#{after}=111",
33
- "@#{before}=111")
34
- assert_normalize_source("@#{after} = 111",
35
- "@#{before} = 111")
36
- assert_normalize_source("(@#{after})",
37
- "(@#{before})")
38
- assert_normalize_source("(xxx, @#{after}, xxx)",
39
- "(xxx, @#{before}, xxx)")
67
+ def test_assign_with_space
68
+ after, before = data
69
+ assert_equal("@#{after} = 111",
70
+ normalize_source("@#{before} = 111"))
40
71
  end
41
72
  end
42
73
  end