ffi-tk 2009.11.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. data/CHANGELOG +748 -0
  2. data/MANIFEST +188 -0
  3. data/README.md +85 -0
  4. data/Rakefile +47 -0
  5. data/TODO.md +62 -0
  6. data/bin/rwish +33 -0
  7. data/doc/MIT_LICENSE +18 -0
  8. data/doc/TCL_LICENSE +39 -0
  9. data/example/choose_color.rb +22 -0
  10. data/example/choose_directory.rb +22 -0
  11. data/example/dialog.rb +37 -0
  12. data/example/hello.rb +11 -0
  13. data/example/message_box.rb +26 -0
  14. data/example/option_menu.rb +17 -0
  15. data/example/popup.rb +24 -0
  16. data/example/set_palette.rb +32 -0
  17. data/example/text.rb +47 -0
  18. data/example/tile/kroc_demo_small.rb +123 -0
  19. data/example/tile/kroc_rb_demo.rb +135 -0
  20. data/example/tile/notebook.rb +48 -0
  21. data/example/tile/theme_hello.rb +38 -0
  22. data/example/tile/treeview.rb +71 -0
  23. data/example/various.rb +25 -0
  24. data/example/wait.rb +16 -0
  25. data/ffi-tk.gemspec +33 -0
  26. data/lib/ffi-tk.rb +76 -0
  27. data/lib/ffi-tk/command.rb +39 -0
  28. data/lib/ffi-tk/command/after.rb +36 -0
  29. data/lib/ffi-tk/command/bell.rb +34 -0
  30. data/lib/ffi-tk/command/bind.rb +11 -0
  31. data/lib/ffi-tk/command/bindtags.rb +69 -0
  32. data/lib/ffi-tk/command/cget.rb +92 -0
  33. data/lib/ffi-tk/command/choose_color.rb +29 -0
  34. data/lib/ffi-tk/command/choose_directory.rb +45 -0
  35. data/lib/ffi-tk/command/clipboard.rb +102 -0
  36. data/lib/ffi-tk/command/configure.rb +88 -0
  37. data/lib/ffi-tk/command/destroy.rb +12 -0
  38. data/lib/ffi-tk/command/dialog.rb +54 -0
  39. data/lib/ffi-tk/command/event.rb +79 -0
  40. data/lib/ffi-tk/command/focus.rb +70 -0
  41. data/lib/ffi-tk/command/font.rb +124 -0
  42. data/lib/ffi-tk/command/get_open_file.rb +85 -0
  43. data/lib/ffi-tk/command/get_save_file.rb +83 -0
  44. data/lib/ffi-tk/command/grab.rb +141 -0
  45. data/lib/ffi-tk/command/grid.rb +246 -0
  46. data/lib/ffi-tk/command/image.rb +79 -0
  47. data/lib/ffi-tk/command/lower.rb +23 -0
  48. data/lib/ffi-tk/command/message_box.rb +65 -0
  49. data/lib/ffi-tk/command/option_menu.rb +8 -0
  50. data/lib/ffi-tk/command/pack.rb +99 -0
  51. data/lib/ffi-tk/command/place.rb +91 -0
  52. data/lib/ffi-tk/command/popup.rb +14 -0
  53. data/lib/ffi-tk/command/raise.rb +25 -0
  54. data/lib/ffi-tk/command/scrollable.rb +151 -0
  55. data/lib/ffi-tk/command/selection.rb +132 -0
  56. data/lib/ffi-tk/command/set_palette.rb +9 -0
  57. data/lib/ffi-tk/command/tk_cmd.rb +155 -0
  58. data/lib/ffi-tk/command/vars.rb +82 -0
  59. data/lib/ffi-tk/command/wait.rb +39 -0
  60. data/lib/ffi-tk/command/winfo.rb +668 -0
  61. data/lib/ffi-tk/command/wm.rb +1025 -0
  62. data/lib/ffi-tk/core_extensions.rb +154 -0
  63. data/lib/ffi-tk/event/data.rb +60 -0
  64. data/lib/ffi-tk/event/handler.rb +44 -0
  65. data/lib/ffi-tk/ffi/tcl.rb +92 -0
  66. data/lib/ffi-tk/ffi/tcl/cmd_proc.rb +10 -0
  67. data/lib/ffi-tk/ffi/tcl/eval_result.rb +148 -0
  68. data/lib/ffi-tk/ffi/tcl/interp.rb +95 -0
  69. data/lib/ffi-tk/ffi/tcl/obj.rb +89 -0
  70. data/lib/ffi-tk/ffi/tcl/time.rb +36 -0
  71. data/lib/ffi-tk/ffi/tk.rb +35 -0
  72. data/lib/ffi-tk/geometry.rb +32 -0
  73. data/lib/ffi-tk/thread_sender.rb +26 -0
  74. data/lib/ffi-tk/tk.rb +222 -0
  75. data/lib/ffi-tk/variable.rb +46 -0
  76. data/lib/ffi-tk/widget.rb +68 -0
  77. data/lib/ffi-tk/widget/button.rb +41 -0
  78. data/lib/ffi-tk/widget/canvas.rb +806 -0
  79. data/lib/ffi-tk/widget/canvas/arc.rb +18 -0
  80. data/lib/ffi-tk/widget/canvas/bitmap.rb +13 -0
  81. data/lib/ffi-tk/widget/canvas/image.rb +10 -0
  82. data/lib/ffi-tk/widget/canvas/item.rb +170 -0
  83. data/lib/ffi-tk/widget/canvas/line.rb +16 -0
  84. data/lib/ffi-tk/widget/canvas/oval.rb +15 -0
  85. data/lib/ffi-tk/widget/canvas/polygon.rb +16 -0
  86. data/lib/ffi-tk/widget/canvas/rectangle.rb +15 -0
  87. data/lib/ffi-tk/widget/canvas/text.rb +15 -0
  88. data/lib/ffi-tk/widget/canvas/window.rb +11 -0
  89. data/lib/ffi-tk/widget/checkbutton.rb +63 -0
  90. data/lib/ffi-tk/widget/entry.rb +208 -0
  91. data/lib/ffi-tk/widget/frame.rb +12 -0
  92. data/lib/ffi-tk/widget/label.rb +26 -0
  93. data/lib/ffi-tk/widget/labelframe.rb +7 -0
  94. data/lib/ffi-tk/widget/listbox.rb +192 -0
  95. data/lib/ffi-tk/widget/menu.rb +318 -0
  96. data/lib/ffi-tk/widget/menubutton.rb +7 -0
  97. data/lib/ffi-tk/widget/message.rb +36 -0
  98. data/lib/ffi-tk/widget/panedwindow.rb +164 -0
  99. data/lib/ffi-tk/widget/radiobutton.rb +43 -0
  100. data/lib/ffi-tk/widget/root.rb +8 -0
  101. data/lib/ffi-tk/widget/scale.rb +44 -0
  102. data/lib/ffi-tk/widget/scrollbar.rb +114 -0
  103. data/lib/ffi-tk/widget/spinbox.rb +198 -0
  104. data/lib/ffi-tk/widget/text.rb +893 -0
  105. data/lib/ffi-tk/widget/text/peer.rb +10 -0
  106. data/lib/ffi-tk/widget/tile.rb +70 -0
  107. data/lib/ffi-tk/widget/tile/button.rb +8 -0
  108. data/lib/ffi-tk/widget/tile/checkbutton.rb +8 -0
  109. data/lib/ffi-tk/widget/tile/combobox.rb +43 -0
  110. data/lib/ffi-tk/widget/tile/entry.rb +8 -0
  111. data/lib/ffi-tk/widget/tile/frame.rb +13 -0
  112. data/lib/ffi-tk/widget/tile/label.rb +9 -0
  113. data/lib/ffi-tk/widget/tile/labelframe.rb +8 -0
  114. data/lib/ffi-tk/widget/tile/menubutton.rb +8 -0
  115. data/lib/ffi-tk/widget/tile/notebook.rb +93 -0
  116. data/lib/ffi-tk/widget/tile/panedwindow.rb +9 -0
  117. data/lib/ffi-tk/widget/tile/progressbar.rb +59 -0
  118. data/lib/ffi-tk/widget/tile/radiobutton.rb +8 -0
  119. data/lib/ffi-tk/widget/tile/scale.rb +8 -0
  120. data/lib/ffi-tk/widget/tile/scrollbar.rb +41 -0
  121. data/lib/ffi-tk/widget/tile/separator.rb +23 -0
  122. data/lib/ffi-tk/widget/tile/sizegrip.rb +24 -0
  123. data/lib/ffi-tk/widget/tile/style.rb +114 -0
  124. data/lib/ffi-tk/widget/tile/treeview.rb +414 -0
  125. data/lib/ffi-tk/widget/toplevel.rb +14 -0
  126. data/spec/ffi-tk/command/bindtags.rb +18 -0
  127. data/spec/ffi-tk/command/clipboard.rb +18 -0
  128. data/spec/ffi-tk/command/font.rb +67 -0
  129. data/spec/ffi-tk/command/grid.rb +6 -0
  130. data/spec/ffi-tk/command/image.rb +26 -0
  131. data/spec/ffi-tk/command/pack.rb +20 -0
  132. data/spec/ffi-tk/command/place.rb +20 -0
  133. data/spec/ffi-tk/command/selection.rb +13 -0
  134. data/spec/ffi-tk/command/vars.rb +32 -0
  135. data/spec/ffi-tk/command/winfo.rb +233 -0
  136. data/spec/ffi-tk/command/wm.rb +185 -0
  137. data/spec/ffi-tk/event.rb +95 -0
  138. data/spec/ffi-tk/tile/button.rb +51 -0
  139. data/spec/ffi-tk/tile/checkbutton.rb +13 -0
  140. data/spec/ffi-tk/tile/combobox.rb +65 -0
  141. data/spec/ffi-tk/tile/entry.rb +61 -0
  142. data/spec/ffi-tk/tile/frame.rb +65 -0
  143. data/spec/ffi-tk/tile/label.rb +17 -0
  144. data/spec/ffi-tk/tile/labelframe.rb +13 -0
  145. data/spec/ffi-tk/tile/menubutton.rb +13 -0
  146. data/spec/ffi-tk/tile/notebook.rb +103 -0
  147. data/spec/ffi-tk/tile/panedwindow.rb +13 -0
  148. data/spec/ffi-tk/tile/progressbar.rb +78 -0
  149. data/spec/ffi-tk/tile/radiobutton.rb +13 -0
  150. data/spec/ffi-tk/tile/scale.rb +13 -0
  151. data/spec/ffi-tk/tile/scrollbar.rb +43 -0
  152. data/spec/ffi-tk/tile/separator.rb +22 -0
  153. data/spec/ffi-tk/tile/sizegrip.rb +13 -0
  154. data/spec/ffi-tk/tile/style.rb +161 -0
  155. data/spec/ffi-tk/tile/treeview.rb +101 -0
  156. data/spec/ffi-tk/variable.rb +24 -0
  157. data/spec/ffi-tk/widget/button.rb +22 -0
  158. data/spec/ffi-tk/widget/canvas.rb +169 -0
  159. data/spec/ffi-tk/widget/checkbutton.rb +44 -0
  160. data/spec/ffi-tk/widget/entry.rb +155 -0
  161. data/spec/ffi-tk/widget/frame.rb +8 -0
  162. data/spec/ffi-tk/widget/label.rb +16 -0
  163. data/spec/ffi-tk/widget/labelframe.rb +12 -0
  164. data/spec/ffi-tk/widget/listbox.rb +19 -0
  165. data/spec/ffi-tk/widget/menu.rb +12 -0
  166. data/spec/ffi-tk/widget/menubutton.rb +12 -0
  167. data/spec/ffi-tk/widget/message.rb +12 -0
  168. data/spec/ffi-tk/widget/panedwindow.rb +12 -0
  169. data/spec/ffi-tk/widget/radiobutton.rb +12 -0
  170. data/spec/ffi-tk/widget/root.rb +9 -0
  171. data/spec/ffi-tk/widget/scale.rb +12 -0
  172. data/spec/ffi-tk/widget/scrollbar.rb +12 -0
  173. data/spec/ffi-tk/widget/spinbox.rb +12 -0
  174. data/spec/ffi-tk/widget/text.rb +246 -0
  175. data/spec/ffi-tk/widget/toplevel.rb +12 -0
  176. data/spec/helper.rb +3 -0
  177. data/tasks/authors.rake +21 -0
  178. data/tasks/bacon.rake +66 -0
  179. data/tasks/changelog.rake +18 -0
  180. data/tasks/gem.rake +22 -0
  181. data/tasks/gem_setup.rake +113 -0
  182. data/tasks/grancher.rake +12 -0
  183. data/tasks/manifest.rake +4 -0
  184. data/tasks/rcov.rake +17 -0
  185. data/tasks/release.rake +65 -0
  186. data/tasks/reversion.rake +8 -0
  187. data/tasks/setup.rake +12 -0
  188. data/tasks/ycov.rake +84 -0
  189. metadata +261 -0
@@ -0,0 +1,8 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Frame do
4
+ it 'creates a new frame' do
5
+ @frame = Tk::Frame.new
6
+ @frame.winfo_exists.should == true
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Label do
4
+ it 'initializes' do
5
+ instance = Tk::Label.new
6
+ instance.class.should == Tk::Label
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ label = Tk::Label.new
12
+ label.value.should == nil
13
+ label.value = 'Hello, World!'
14
+ label.value.should == 'Hello, World!'
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::LabelFrame do
4
+ it 'initializes' do
5
+ instance = Tk::LabelFrame.new
6
+ instance.class.should == Tk::LabelFrame
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Listbox do
4
+ it 'initializes' do
5
+ instance = Tk::Listbox.new
6
+ instance.class.should == Tk::Listbox
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'Make sure we get contents of the list' do
11
+ list = Tk::Listbox.new
12
+ list.insert 0, "first line"
13
+ list.get(0).should == "first line"
14
+ list.insert 1, "second line"
15
+ list.get(1).should == "second line"
16
+ list.get(0, 1).should == ['first line', 'second line']
17
+ list.value.should == ['first line', 'second line']
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Menu do
4
+ it 'initializes' do
5
+ instance = Tk::Menu.new
6
+ instance.class.should == Tk::Menu
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ #it 'needs more specs' do
11
+ #end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::MenuButton do
4
+ it 'initializes' do
5
+ instance = Tk::MenuButton.new
6
+ instance.class.should == Tk::MenuButton
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Message do
4
+ it 'initializes' do
5
+ instance = Tk::Message.new
6
+ instance.class.should == Tk::Message
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::PanedWindow do
4
+ it 'initializes' do
5
+ instance = Tk::PanedWindow.new
6
+ instance.class.should == Tk::PanedWindow
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::RadioButton do
4
+ it 'initializes' do
5
+ instance = Tk::RadioButton.new
6
+ instance.class.should == Tk::RadioButton
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Root do
4
+ it 'initializes' do
5
+ instance = Tk::Root.new
6
+ instance.class.should == Tk::Root
7
+ instance.tk_parent.should == nil
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Scale do
4
+ it 'initializes' do
5
+ instance = Tk::Scale.new
6
+ instance.class.should == Tk::Scale
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Scrollbar do
4
+ it 'initializes' do
5
+ instance = Tk::Scrollbar.new
6
+ instance.class.should == Tk::Scrollbar
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Spinbox do
4
+ it 'initializes' do
5
+ instance = Tk::Spinbox.new
6
+ instance.class.should == Tk::Spinbox
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end
@@ -0,0 +1,246 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Text do
4
+ text = Tk::Text.new
5
+ text.insert :end, 'Hello, World!'
6
+
7
+ it 'gets the text at index' do
8
+ text.get('end').should == ''
9
+ text.get('1.0').should == 'H'
10
+ end
11
+
12
+ it 'gets text between two indices' do
13
+ text.get('1.0', 'end').should == "Hello, World!\n"
14
+ end
15
+
16
+ it 'gets all possible options with cget' do
17
+ text.cget(:autoseparators ).should == true
18
+ text.cget(:background ).should == "#ffffff"
19
+ text.cget(:bd ).should == 1
20
+ text.cget(:bg ).should == "#ffffff"
21
+ text.cget(:blockcursor ).should == false
22
+ text.cget(:borderwidth ).should == 1
23
+ text.cget(:cursor ).should == "xterm"
24
+ text.cget(:endline ).should == 0
25
+ text.cget(:exportselection ).should == true
26
+ text.cget(:fg ).should == "#000000"
27
+ text.cget(:font ).should == "TkFixedFont"
28
+ text.cget(:foreground ).should == "#000000"
29
+ text.cget(:height ).should == 24
30
+ text.cget(:highlightbackground ).should == "#d9d9d9"
31
+ text.cget(:highlightcolor ).should == "#000000"
32
+ text.cget(:highlightthickness ).should == 1
33
+ text.cget(:inactiveselectbackground).should == "#c3c3c3"
34
+ text.cget(:insertbackground ).should == "#000000"
35
+ text.cget(:insertborderwidth ).should == 0
36
+ text.cget(:insertofftime ).should == 300
37
+ text.cget(:insertontime ).should == 600
38
+ text.cget(:insertwidth ).should == 2
39
+ text.cget(:maxundo ).should == 0
40
+ text.cget(:padx ).should == 1
41
+ text.cget(:pady ).should == 1
42
+ text.cget(:relief ).should == :sunken
43
+ text.cget(:selectbackground ).should == "#c3c3c3"
44
+ text.cget(:selectborderwidth ).should == 0
45
+ text.cget(:selectforeground ).should == "#000000"
46
+ text.cget(:setgrid ).should == false
47
+ text.cget(:spacing1 ).should == 0
48
+ text.cget(:spacing2 ).should == 0
49
+ text.cget(:spacing3 ).should == 0
50
+ text.cget(:startline ).should == 0
51
+ text.cget(:state ).should == ['normal']
52
+ text.cget(:tabs ).should == nil
53
+ text.cget(:tabstyle ).should == :tabular
54
+ text.cget(:takefocus ).should == false
55
+ text.cget(:undo ).should == false
56
+ text.cget(:width ).should == 80
57
+ text.cget(:wrap ).should == :char
58
+ text.cget(:xscrollcommand ).should == nil
59
+ text.cget(:yscrollcommand ).should == nil
60
+ end
61
+
62
+ it 'configures a single option' do
63
+ text.cget(:wrap).should == :char
64
+ text.configure(wrap: :word)
65
+ text.cget(:wrap).should == :word
66
+ end
67
+
68
+ it 'configures more options at once' do
69
+ text.cget(:width).should == 80
70
+ text.cget(:height).should == 24
71
+ text.configure(width: 20, height: 20)
72
+ text.cget(:width).should == 20
73
+ text.cget(:height).should == 20
74
+ end
75
+
76
+ it 'compares two indices' do
77
+ text.compare('1.0', '==', '1.1').should == false
78
+ text.compare('1.0', '>', '1.1').should == false
79
+ text.compare('1.0', '<', '1.1').should == true
80
+ text.compare('1.0', '!=', '1.1').should == true
81
+ text.compare('1.0', '<=', '1.1').should == true
82
+ text.compare('1.0', '>=', '1.1').should == false
83
+ end
84
+
85
+ it 'counts chars' do
86
+ text.count('1.0', 'end', :chars).should == 14
87
+ end
88
+
89
+ it 'counts displaychars' do
90
+ text.count(1.0, :end, :displaychars).should == 14
91
+ end
92
+
93
+ it 'counts displayindices' do
94
+ text.count(1.0, :end, :displayindices).should == 14
95
+ end
96
+
97
+ it 'counts displaylines' do
98
+ text.count(1.0, :end, :displaylines).should == 13
99
+ end
100
+
101
+ it 'counts indices' do
102
+ text.count(1.0, :end, :indices).should == 14
103
+ end
104
+
105
+ it 'counts lines' do
106
+ text.count(1.0, :end, :lines).should == 1
107
+ end
108
+
109
+ it 'counts xpixels' do
110
+ text.count(1.0, :end, :xpixels).should == 0
111
+ end
112
+
113
+ it 'counts ypixels' do
114
+ text.count(1.0, :end, :ypixels).should == 195
115
+ end
116
+
117
+ should 'not be in debug mode' do
118
+ text.debug?.should == false
119
+ end
120
+
121
+ it 'deletes at index' do
122
+ text.delete(1.0)
123
+ text.get(1.0, 'end').should == "ello, World!\n"
124
+ end
125
+
126
+ it 'deletes between indices' do
127
+ text.delete(1.2, 1.5)
128
+ text.get(1.0, 'end').should == "el World!\n"
129
+ end
130
+
131
+ it 'gives line info' do
132
+ info = text.dlineinfo(1.0)
133
+ info.size.should == 5
134
+ info.all?{|i| i.kind_of?(Fixnum) }
135
+ end
136
+
137
+ it 'inserts string with taglist' do
138
+ text.insert(1.0, 'H', 'start')
139
+ text.get(1.0, :end).should == "Hel World!\n"
140
+ end
141
+
142
+ it 'queries mark gravity' do
143
+ text.mark_gravity(:insert).should == :right
144
+ end
145
+
146
+ it 'changes mark gravity' do
147
+ text.mark_gravity(:insert, :left)
148
+ text.mark_gravity(:insert).should == :left
149
+ text.mark_gravity(:insert, :right)
150
+ end
151
+
152
+ it 'lists mark names' do
153
+ text.mark_names.sort.should == [:current, :insert]
154
+ end
155
+
156
+ it 'answers with the next mark after index' do
157
+ text.mark_next('1.0').should == :insert
158
+ text.mark_next(:insert).should == :current
159
+ text.mark_next(:current).should.be.nil
160
+ end
161
+
162
+ it 'ansewrs with the previous mark before index' do
163
+ text.mark_previous(:end).should == :current
164
+ text.mark_previous(:current).should == :insert
165
+ text.mark_previous(:insert).should.be.nil
166
+ end
167
+
168
+ it 'sets a mark' do
169
+ text.mark_set('foo', '1.3')
170
+ text.mark_names.sort.should == [:current, :foo, :insert]
171
+ end
172
+
173
+ it 'unsets a mark' do
174
+ text.mark_unset('foo')
175
+ text.mark_names.sort.should == [:current, :insert]
176
+ end
177
+
178
+ it 'creates a peer' do
179
+ @peer = text.peer_create
180
+ @peer.tk_pathname.should == '.text0.text1'
181
+ end
182
+
183
+ it 'lists the peer' do
184
+ text.peer_names.should == ['.text0.text1']
185
+ end
186
+
187
+ it 'destroys the peer' do
188
+ @peer.destroy
189
+ text.peer_names.should == []
190
+ end
191
+
192
+ it 'searches for {}' do
193
+ text.insert :end, '{ now some text in here}'
194
+ text.search(/\{/, '1.0', 'end', :all).should == ['1.10']
195
+ text.search(/\}/, '1.0', 'end', :all).should == ['1.33']
196
+ text.search(/[{}]/, '1.0', 'end', :all).should == ['1.10', '1.33']
197
+ end
198
+
199
+ text.delete '1.0', 'end'
200
+ text.insert(:end, <<-TEXT)
201
+ Est magni ex et voluptatem possimus deserunt qui. Ex necessitatibus molestiae aperiam illo. Voluptatem omnis eum illum tenetur inventore. Exercitationem non voluptatem et. Aut molestiae exercitationem veritatis voluptates unde nam possimus dolore.
202
+ Ea dolores qui et odit officia quibusdam autem. Optio quia inventore aspernatur. Eos ipsam maxime sed dignissimos minus. Mollitia fugiat voluptate sunt non illum nam adipisci.
203
+ Reprehenderit soluta laudantium dicta illo fuga sit illum. Enim placeat rerum sunt dicta in sed. Enim quia rerum ducimus.
204
+ Et nam eum veritatis aut. Deleniti praesentium voluptatem quis ab et. Voluptas est ratione sunt quis nam recusandae autem nemo. Ad fugiat maxime aut et odio.
205
+ Nostrum possimus nisi iure inventore corporis. Voluptatem omnis est tempore est aliquam ut. Corporis quia totam in fuga dolorum. Nihil et aut voluptatem aliquid dolor. Iure tempora iste quia.
206
+ Reprehenderit perferendis sit vel aliquam dolor eum repellat. Odit dicta consequatur nulla maiores et. Cumque quia excepturi ea autem velit eos.
207
+ Pariatur reiciendis quis est magni et. Nostrum aperiam ipsa ullam ad excepturi aliquam repellat. Sequi dolor saepe tenetur. Sunt nihil reiciendis ea non odit quia.
208
+ Blanditiis sunt reiciendis non qui repellendus fugit. Esse dolorum aut unde nobis cupiditate expedita. Quae natus rerum temporibus.
209
+ Dolor enim sint delectus quo fuga provident qui eum. Nisi commodi dolores dolorem amet officiis ipsam voluptatum. Et possimus corporis et aliquam cum omnis. Laudantium sed aut officiis.
210
+ Eligendi voluptas nostrum magni ea dolores ut vel in. Quas aspernatur deleniti possimus autem qui neque facere. Dolores alias non quibusdam repellendus consequatur voluptatem. Quisquam quae fuga et eum doloremque rerum. Qui optio doloremque voluptates esse deserunt doloribus voluptatem illo.
211
+ Voluptatum molestiae voluptatibus sequi sed a. In beatae doloribus molestiae. Eos officiis ea voluptate praesentium est. Quod dolore earum accusamus et.
212
+ Harum nesciunt qui dolores necessitatibus blanditiis enim incidunt non. Similique et odio quos voluptas tempore in veritatis. Labore rerum asperiores doloribus aperiam cupiditate. Dolorum provident assumenda illum amet id modi voluptas.
213
+ Et recusandae itaque atque aliquam. Perspiciatis non est quasi assumenda veniam consectetur. Officia rerum sed odio aut voluptatem eos repellendus exercitationem. Tempora quis expedita et quis eos. Ut dolor est et.
214
+ Minus soluta architecto ratione repudiandae magni maxime. Dolorem beatae dolorem fugiat amet maxime. Est sint molestiae officia quisquam aperiam sit eaque.
215
+ Voluptatem magnam occaecati laboriosam fugiat natus ex et. Unde id veritatis dignissimos ipsa. Natus eaque facilis deleniti et quos asperiores eos. Deserunt expedita blanditiis aut.
216
+ Accusamus cumque itaque voluptatem dolores. Et et quos et dolor necessitatibus. Voluptatem voluptatem temporibus provident. Consectetur sequi id rerum.
217
+ Molestiae quia ipsa eos minus cupiditate tempora quasi consequuntur. Dolores nisi consequatur et fugiat culpa eius quos et. Ipsum eos qui eius dolorem nisi.
218
+ Repellat veniam sint consectetur dicta quia quas eos numquam. Sint libero temporibus et ad quia rerum. Expedita aut a odit non et nostrum.
219
+ Saepe voluptas architecto debitis tenetur voluptatem cum rerum. Assumenda unde possimus eum et accusantium. Reiciendis voluptas repellendus magnam tempore est perferendis ut. Qui cum et rerum pariatur.
220
+ Voluptates dicta labore impedit deserunt quod. Vero sint rerum at asperiores eos. Saepe nam sint sint. Non et assumenda molestiae et sunt perferendis qui corrupti. Est velit qui quam.
221
+ TEXT
222
+
223
+ describe 'Text#search' do
224
+ it 'searches by exact match' do
225
+ text.search("et", '1.0', :end).should == ['1.13']
226
+ text.search("labore", '1.0', :end).should == ['20.17']
227
+ end
228
+
229
+ it 'searches by regular expression' do
230
+ text.search(/e[t]/, '1.0', :end).should == ['1.13']
231
+ text.search(/E[T]/i, '1.0', :end).should == ['1.13']
232
+ text.search(/DOLORE\.\nEA/i, '1.0', :end).should == ['1.240']
233
+ end
234
+
235
+ it 'searches with regexp and switches' do
236
+ text.search(/DOLORE\..EA/i, '1.0', :end, :nolinestop).should == ['1.240']
237
+ end
238
+
239
+ it 'searches with :count' do
240
+ text.search('et', '1.0', :end, :count).should == ['1.13', 2]
241
+ text.search('velit', '1.0', :end, :all, :count).should == [['6.134', 5], ['20.168', 5]]
242
+ end
243
+ end
244
+
245
+ # TODO: image handling
246
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../helper'
2
+
3
+ describe Tk::Toplevel do
4
+ it 'initializes' do
5
+ instance = Tk::Toplevel.new
6
+ instance.class.should == Tk::Toplevel
7
+ instance.tk_parent.should == Tk.root
8
+ end
9
+
10
+ it 'needs more specs' do
11
+ end
12
+ end