Sha256: 0fc8e0a6f782936fb6f7fd83954c75cf7cb9150dd19ad4f6b2705256c695b1c6
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 KB
Contents
# coding: utf-8 require 'test_helper' class Thinreports::Core::Shape::TextBlock::TestInterface < Minitest::Test include Thinreports::TestHelper # Alias TextBlock = Thinreports::Core::Shape::TextBlock def create_interface(format_config = {}) report = new_report 'layout_text1' parent = report.start_new_page TextBlock::Interface.new parent, TextBlock::Format.new(format_config) end def test_format_enabled_asker_should_operate_as_delegator_of_internal tblock = create_interface('format' => {'type' => 'datetime'}) assert_equal tblock.format_enabled?, tblock.internal.format_enabled? end def test_format_enabled_should_properly_set_value_to_internal tblock = create_interface('format' => {'type' => 'number'}) tblock.format_enabled(false) assert_equal tblock.internal.format_enabled?, false end def test_set_should_properly_set_a_value tblock = create_interface tblock.set(1000, visible: false) assert_equal tblock.value, 1000 end def test_set_should_properly_set_styles tblock = create_interface tblock.set(1000, color: '#ff0000', bold: true, italic: true) assert_equal [tblock.style(:color), tblock.style(:bold), tblock.style(:italic)], ['#ff0000', true, true] end def test_value= report = new_report 'layout_block.tlf' page = report.start_new_page page.item(:text_block1).value = 'foo' assert_equal 'foo', page.item(:text_block1).value page.item(:text_block1).value += 'bar' assert_equal 'foobar', page.item(:text_block1).value page.item(:text_block1).value = 1000 page.item(:text_block1).value += 999 assert_equal 1999, page.item(:text_block1).value end end
Version data entries
3 entries across 3 versions & 1 rubygems