Skip to content

Commit 20f1d96

Browse files
committed
Add more tests for worksheet layout
1 parent 657fe80 commit 20f1d96

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Diff for: test/worksheet_test.rb

+34
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,38 @@
9292
assert_equal("foo", ws1[:name])
9393
assert_equal("", ws2[:name])
9494
end
95+
96+
it "should map fields correctly" do
97+
workbook = FastExcel.open(constant_memory: true)
98+
99+
ws = workbook.add_worksheet
100+
ws.right_to_left
101+
assert_equal(ws[:right_to_left], 1)
102+
103+
ws = workbook.add_worksheet
104+
ws.center_vertically
105+
assert_equal(ws[:print_options_changed], 1)
106+
assert_equal(ws[:vcenter], 1)
107+
108+
ws = workbook.add_worksheet
109+
ws.print_row_col_headers
110+
assert_equal(ws[:print_headers], 1)
111+
assert_equal(ws[:print_options_changed], 1)
112+
113+
ws = workbook.add_worksheet
114+
ws.set_margins(1.5, 2.5, 3.5, 4.5)
115+
assert_equal(ws[:margin_left], 1.5)
116+
assert_equal(ws[:margin_right], 2.5)
117+
assert_equal(ws[:margin_top], 3.5)
118+
assert_equal(ws[:margin_bottom], 4.5)
119+
120+
121+
breaks = [20, 40, 60, 20, 0]
122+
FFI::MemoryPointer.new(:uint16, breaks.size) do |buffer|
123+
buffer.write_array_of_uint16(breaks)
124+
ws.set_v_pagebreaks(buffer)
125+
end
126+
127+
assert_equal(ws[:vbreaks_count], 4)
128+
end
95129
end

0 commit comments

Comments
 (0)