From 8280a21a23d44aa90177e2bc041d0b8dc8556f4b Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Mon, 12 Jun 2017 03:37:11 -0400 Subject: Import Upstream version 2.7.1 --- test/helpers/test_styles.rb | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 test/helpers/test_styles.rb (limited to 'test/helpers/test_styles.rb') diff --git a/test/helpers/test_styles.rb b/test/helpers/test_styles.rb new file mode 100644 index 0000000..476fe7d --- /dev/null +++ b/test/helpers/test_styles.rb @@ -0,0 +1,62 @@ +module TestStyles + def test_cell_styles + # styles only valid in excel spreadsheets? + # TODO: what todo with other spreadsheet types + with_each_spreadsheet(name: "style", format: [:excelx]) do |oo| + # bold + assert_equal true, oo.font(1, 1).bold? + assert_equal false, oo.font(1, 1).italic? + assert_equal false, oo.font(1, 1).underline? + + # italic + assert_equal false, oo.font(2, 1).bold? + assert_equal true, oo.font(2, 1).italic? + assert_equal false, oo.font(2, 1).underline? + + # normal + assert_equal false, oo.font(3, 1).bold? + assert_equal false, oo.font(3, 1).italic? + assert_equal false, oo.font(3, 1).underline? + + # underline + assert_equal false, oo.font(4, 1).bold? + assert_equal false, oo.font(4, 1).italic? + assert_equal true, oo.font(4, 1).underline? + + # bold italic + assert_equal true, oo.font(5, 1).bold? + assert_equal true, oo.font(5, 1).italic? + assert_equal false, oo.font(5, 1).underline? + + # bold underline + assert_equal true, oo.font(6, 1).bold? + assert_equal false, oo.font(6, 1).italic? + assert_equal true, oo.font(6, 1).underline? + + # italic underline + assert_equal false, oo.font(7, 1).bold? + assert_equal true, oo.font(7, 1).italic? + assert_equal true, oo.font(7, 1).underline? + + # bolded row + assert_equal true, oo.font(8, 1).bold? + assert_equal false, oo.font(8, 1).italic? + assert_equal false, oo.font(8, 1).underline? + + # bolded col + assert_equal true, oo.font(9, 2).bold? + assert_equal false, oo.font(9, 2).italic? + assert_equal false, oo.font(9, 2).underline? + + # bolded row, italic col + assert_equal true, oo.font(10, 3).bold? + assert_equal true, oo.font(10, 3).italic? + assert_equal false, oo.font(10, 3).underline? + + # normal + assert_equal false, oo.font(11, 4).bold? + assert_equal false, oo.font(11, 4).italic? + assert_equal false, oo.font(11, 4).underline? + end + end +end -- cgit v1.2.3