File: test_styles.rb

package info (click to toggle)
ruby-roo 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,216 kB
  • sloc: ruby: 6,529; xml: 88; makefile: 6
file content (62 lines) | stat: -rw-r--r-- 2,036 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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