test/test_21_escher.rb in writeexcel-0.6.9 vs test/test_21_escher.rb in writeexcel-0.6.10
- old
+ new
@@ -27,18 +27,10 @@
def setup
@workbook = WriteExcel.new(StringIO.new)
@worksheet = @workbook.add_worksheet
end
- def teardown
- @workbook.close
- end
-
- def test_dummy
- assert(true)
- end
-
def test_for_store_mso_dg_container
caption = sprintf(" \t_store_mso_dg_container()")
data = [0xC8]
target = %w( 0F 00 02 F0 C8 00 00 00 ).join(' ')
@@ -47,16 +39,16 @@
assert_equal(target, result, caption)
end
def test_for_store_mso_dg
caption = sprintf(" \t_store_mso_dg()")
- data = [1, 2, 1025]
+ @worksheet.instance_variable_set(:@object_ids, Writeexcel::Worksheet::ObjectIds.new(nil, 1, 2, 1025))
target = %w( 10 00 08 F0
08 00 00 00 02 00 00 00 01 04 00 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_dg", *data))
+ result = unpack_record(@worksheet.__send__("store_mso_dg"))
assert_equal(target, result, caption)
end
def test_for_store_mso_dgg
@@ -117,20 +109,21 @@
assert_equal(target, result, caption)
end
def test_for_store_mso_opt_comment
caption = sprintf(" \t_store_mso_opt_comment()")
+ comment = Writeexcel::Worksheet::Comment.new(@worksheet, 1, 1, ' ')
data = [0x80]
target = %w(
93 00 0B F0 36 00 00 00
80 00 00 00 00 00 BF 00 08 00 08 00
58 01 00 00 00 00 81 01 50 00 00 08 83 01 50 00
00 08 BF 01 10 00 11 00 01 02 00 00 00 00 3F 02
03 00 03 00 BF 03 02 00 0A 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_opt_comment", *data))
+ result = unpack_record(comment.store_mso_opt_comment(*data))
assert_equal(target, result, caption)
end
def test_for_store_mso_client_data
@@ -142,221 +135,219 @@
result = unpack_record(@worksheet.__send__("store_mso_client_data"))
assert_equal(target, result, caption)
end
- def test_for_store_obj_comment
- caption = sprintf(" \t_store_obj_comment")
+ def test_for_obj_comment_record
+ caption = sprintf(" \t_obj_comment_record")
+ comment = Writeexcel::Worksheet::Comment.new(@worksheet, 1, 1, ' ')
data = [0x01]
target = %w(
5D 00 34 00 15 00 12 00 19 00 01 00 11 40 00 00
00 00 00 00 00 00 00 00 00 00 0D 00 16 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_obj_comment", *data))
+ result = unpack_record(comment.obj_comment_record(*data))
assert_equal(target, result, caption)
end
def test_for_store_mso_client_text_box
caption = sprintf(" \t_store_mso_client_text_box")
+ comment = Writeexcel::Worksheet::Comment.new(@worksheet, 1, 1, ' ')
target = %w(
00 00 0D F0 00 00 00 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_text_box"))
+ result = unpack_record(comment.__send__("store_mso_client_text_box"))
assert_equal(target, result, caption)
end
def test_for_store_mso_client_anchor
# A1
range = 'A1'
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 00 00
1E 00 03 00 F0 00 04 00 78 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# A2
range = 'A2'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 00 00
69 00 03 00 F0 00 04 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# A3
range = 'A3'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 01 00
69 00 03 00 F0 00 05 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# A65534
range = 'A65534'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 F9 FF
3C 00 03 00 F0 00 FD FF 97 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# A65536
range = 'A65536'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 FB FF
1E 00 03 00 F0 00 FF FF 78 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# IT3
range = 'IT3'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 FA 00 10 03 01 00
69 00 FC 00 10 03 05 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# IU3
range = 'IU3'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 FB 00 10 03 01 00
69 00 FD 00 10 03 05 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
#
range = 'IU3'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 FB 00 10 03 01 00
69 00 FD 00 10 03 05 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# IV3
range = 'IV3'
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00 FC 00 10 03 01 00
69 00 FE 00 10 03 05 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
end
def test_for_store_mso_client_anchor_where_comment_offsets_have_changed
- range = 'A3'
- caption = sprintf(" \t_store_mso_client_anchor(%s). Cell offsets changes.", range)
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test',
- :x_offset=>18, :y_offset=>9)
- data = data[-1]
+ range = 'A3'
+ caption = sprintf(" \t_store_mso_client_anchor(%s). Cell offsets changes.", range)
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test',
+ :x_offset => 18, :y_offset => 9).vertices
target = %w(
00 00 10 F0 12 00
00 00 03 00 01 00 20 01 01 00 88 00 03 00 20 01
05 00 E2 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
end
def test_for_store_mso_client_anchor_where_comment_dimensions_have_changed
# x_scale, y_scale
range = 'A3'
caption = sprintf(" \t_store_mso_client_anchor(%s). Dimensions changes.", range)
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test',
- :x_scale=>3, :y_scale=>2)
- data = data[-1]
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test',
+ :x_scale => 3, :y_scale => 2).vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00
01 00 F0 00 01 00 69 00 07 00 F0 00 0A 00 1E 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# width, height
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test',
- :width=>384, :height=>148)
- data = data[-1]
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test',
+ :width => 384, :height => 148).vertices
target = %w(
00 00 10 F0 12 00 00 00 03 00
01 00 F0 00 01 00 69 00 07 00 F0 00 0A 00 1E 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
end
@@ -364,40 +355,38 @@
# set_column G:G
range = 'F3'
@worksheet.set_column('G:G', 20)
caption = sprintf(" \t_store_mso_client_anchor(%s). Col width changes.", range)
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00
00 00 03 00 06 00 6A 00 01 00 69 00 06 00 F2 03
05 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# set_column L:O
range = 'K3'
@worksheet.set_column('L:O', 4)
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00
00 00 03 00 0B 00 D1 01 01 00 69 00 0F 00 B0 00
05 00 C4 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
end
@@ -408,40 +397,38 @@
@worksheet.set_row(6, 6)
@worksheet.set_row(7, 6)
@worksheet.set_row(8, 6)
caption = sprintf(" \t_store_mso_client_anchor(%s). Row height changed.", range)
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00
00 00 03 00 01 00 F0 00 04 00 69 00 03 00 F0 00
0A 00 E2 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
# set_row 14
range = 'A15'
@worksheet.set_row(14, 60)
caption = sprintf(" \t_store_mso_client_anchor(%s). Row height changed.", range)
- data = @worksheet.__send__("substitute_cellref", range)
- data = @worksheet.__send__("comment_params", data[0], data[1], 'Test')
- data = data[-1]
+ row, col = @worksheet.__send__("substitute_cellref", range)
+ vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
target = %w(
00 00 10 F0 12 00
00 00 03 00 01 00 F0 00 0D 00 69 00 03 00 F0 00
0E 00 CD 00
).join(' ')
- result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *data))
+ result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
assert_equal(target, result, caption)
end