Changeset 29107
- Timestamp:
- 01/27/09 11:56:48 (4 years ago)
- Location:
- lang/ruby/ruwin
- Files:
-
- 3 modified
-
lib/ruwin/edit_field.rb (modified) (1 diff)
-
lib/ruwin/edit_field/rich.rb (modified) (1 diff)
-
test/ruwin/testm_edit_field.rb (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/ruwin/lib/ruwin/edit_field.rb
r29102 r29107 104 104 end 105 105 106 private :caption= 107 def string= string 108 self.caption = string.gsub(/\r\n|\r|\n/m, "") 109 end 110 106 111 class Multiline < EditField 107 112 STYLE = Control::STYLE | ES_MULTILINE | ES_AUTOVSCROLL 113 114 def string= string 115 self.caption = string.gsub(/\r\n|\r|\n/m, "\r\n") 116 end 108 117 end 109 118 end -
lang/ruby/ruwin/lib/ruwin/edit_field/rich.rb
r29102 r29107 97 97 class Multiline < Rich 98 98 STYLE = EditField::Multiline::STYLE 99 100 def string= string 101 self.caption = string.gsub(/\r\n|\r|\n/m, "\r\n") 102 end 99 103 end 100 104 end -
lang/ruby/ruwin/test/ruwin/testm_edit_field.rb
r29102 r29107 96 96 97 97 def test_string 98 @control. caption= "caption"98 @control.string = "caption" 99 99 assert_equal "caption", @control.string 100 100 end … … 109 109 110 110 def test_concat 111 @control. caption= "caption"111 @control.string = "caption" 112 112 @control.selection.change 1, 4 113 113 @control.concat "-concat" … … 120 120 121 121 def test_selection 122 @control. caption= "caption"122 @control.string = "caption" 123 123 @control.selection.change 2, 5 124 124 … … 132 132 133 133 def test_range_selection 134 @control. caption= "caption"134 @control.string = "caption" 135 135 @control.selection.change 2, 5 136 136 … … 145 145 146 146 def test_tail 147 @control. caption= "caption"147 @control.string = "caption" 148 148 @control.selection.change 2, 5 149 149 … … 158 158 159 159 def test_head 160 @control. caption= "caption"160 @control.string = "caption" 161 161 @control.selection.change 2, 5 162 162 … … 172 172 173 173 def test_like_string_upcase 174 @control. caption= "caption"174 @control.string = "caption" 175 175 assert_equal "CAPTION", @control.upcase 176 176 assert_equal "caption", @control.caption … … 178 178 179 179 def test_like_string_upcase_d 180 @control. caption= "caption"180 @control.string = "caption" 181 181 assert_equal "CAPTION", @control.upcase! 182 182 assert_equal "CAPTION", @control.caption … … 196 196 assert_equal 0, (self.class::TARGET_CLASS::STYLE&(ES_MULTILINE)) 197 197 assert_equal ES_AUTOHSCROLL, (self.class::TARGET_CLASS::STYLE&(ES_AUTOHSCROLL)) 198 end 199 200 201 def test_string_should_deny_return 202 klass = Class.new(self.class::TARGET_CLASS) 203 control = klass.new(@window) 204 control.string = "caption\r\ncaption\rcaption\ncaption" 205 assert_equal "captioncaptioncaptioncaption", control.caption 198 206 end 199 207 end … … 209 217 assert_equal 0, (self.class::TARGET_CLASS::STYLE&(Ruwin::Const::Window::WS_VSCROLL)) 210 218 end 219 220 221 def test_string_should_allow_return 222 klass = Class.new(self.class::TARGET_CLASS) 223 control = klass.new(@window) 224 control.string = "caption\r\ncaption\rcaption\ncaption" 225 assert_equal "caption\r\ncaption\r\ncaption\r\ncaption", control.caption 226 end 211 227 end 212 228 … … 247 263 248 264 def test_change 249 @control. caption= "caption"265 @control.string = "caption" 250 266 @selection.change 2, 5 251 267 assert_equal [[EM_SETSEL, 2, 5]], @control.message_log … … 255 271 256 272 def test_change_without_reflection 257 @control. caption= "caption"273 @control.string = "caption" 258 274 @selection_without_reflection.change 2, 5 259 275 assert_equal [], @control.message_log … … 263 279 264 280 def test_first_setter 265 @control. caption= "caption"281 @control.string = "caption" 266 282 @selection.change 2, 5 267 283 @control.message_log.clear … … 273 289 274 290 def test_last_setter 275 @control. caption= "caption"291 @control.string = "caption" 276 292 @selection.change 2, 5 277 293 @control.message_log.clear … … 284 300 285 301 def test_range 286 @control. caption= "caption"302 @control.string = "caption" 287 303 @selection.change 2, 5 288 304 @control.message_log.clear … … 293 309 294 310 def test_change_without_reflection 295 @control. caption= "caption"311 @control.string = "caption" 296 312 @selection_without_reflection.change 2, 5 297 313 @control.message_log.clear … … 302 318 303 319 def test_first_getter 304 @control. caption= "caption"320 @control.string = "caption" 305 321 @selection.change 2, 5 306 322 @control.message_log.clear … … 311 327 312 328 def test_last_getter 313 @control. caption= "caption"329 @control.string = "caption" 314 330 @selection.change 2, 5 315 331 @control.message_log.clear … … 321 337 322 338 def test_string_getter 323 @control. caption= "caption"339 @control.string = "caption" 324 340 @selection.change 1, 4 325 341 assert_equal "apt", @selection.string … … 327 343 328 344 def test_string_getter_without_reflection 329 @control. caption= "caption"345 @control.string = "caption" 330 346 @selection_without_reflection.change 1, 4 331 347 assert_equal "apt", @selection_without_reflection.string … … 334 350 335 351 def test_string_setter 336 @control. caption= "caption"352 @control.string = "caption" 337 353 @selection.change 3, 6 338 354 @selection.string = "ricor" … … 341 357 342 358 def test_string_setter_without_reflection 343 @control. caption= "caption"359 @control.string = "caption" 344 360 @selection_without_reflection.change 3, 6 345 361 @selection_without_reflection.string = "ricor" … … 350 366 351 367 def test_with 352 @control. caption= "caption"368 @control.string = "caption" 353 369 354 370 selection_with = nil … … 362 378 363 379 def test_with_without_reflection 364 @control. caption= "caption"380 @control.string = "caption" 365 381 @selection_without_reflection.change 3, 6 366 382 … … 380 396 381 397 def test_length 382 @control. caption= "caption"398 @control.string = "caption" 383 399 @selection.change 1, 4 384 400 assert_equal 3, @selection.length
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)