Sha256: 4453ed3839dad897235ab158aa82dd2f3e20e7a1fbe0da6d224eca5e37995cad

Contents?: true

Size: 1010 Bytes

Versions: 14

Compression:

Stored size: 1010 Bytes

Contents

# Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.

require_relative './lib/wxframe_runner'

class StyledTextCtrlTests < WxRuby::Test::GUITests

  def setup
    super
    @text = Wx::STC::StyledTextCtrl.new(frame_win, name: 'StyledText')
  end

  def cleanup
    @text.destroy
    super
  end

  attr_reader :text

  def test_text
    assert_equal('', text.get_value)
  end

  def test_enumerate_lines
    text.write_text <<~__HEREDOC
      This is line 1.
      This is line 2.
      This is line 3.
      __HEREDOC
    assert_equal(4, text.get_number_of_lines)
    text.each_line.each_with_index do |txt, lnr|
      if lnr < 3
        assert("This is line #{lnr+1}.", txt)
      else
        assert('', txt)
      end
    end
    txt = text.each_line { |l| break l if l.index('2')}
    assert_equal('This is line 2.', txt)
    line_enum = text.each_line
    txt = line_enum.detect { |l| l.index('3') }
    assert_equal('This is line 3.', txt)
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
wxruby3-1.3.1 tests/test_styled_text_ctrl.rb
wxruby3-1.3.0 tests/test_styled_text_ctrl.rb
wxruby3-1.2.1 tests/test_styled_text_ctrl.rb
wxruby3-1.2.0 tests/test_styled_text_ctrl.rb
wxruby3-1.1.2 tests/test_styled_text_ctrl.rb
wxruby3-1.1.1 tests/test_styled_text_ctrl.rb
wxruby3-1.1.0 tests/test_styled_text_ctrl.rb
wxruby3-1.0.1 tests/test_styled_text_ctrl.rb
wxruby3-0.9.8 tests/test_styled_text_ctrl.rb
wxruby3-0.9.7 tests/test_styled_text_ctrl.rb
wxruby3-0.9.5 tests/test_styled_text_ctrl.rb
wxruby3-0.9.4 tests/test_styled_text_ctrl.rb
wxruby3-0.9.3 tests/test_styled_text_ctrl.rb
wxruby3-0.9.2 tests/test_styled_text_ctrl.rb