roo 2.7.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -1
- data/lib/roo/base.rb +4 -5
- data/lib/roo/csv.rb +2 -2
- data/lib/roo/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/test/formatters/test_csv.rb +2 -2
- data/test/formatters/test_xml.rb +13 -9
- data/test/helpers/test_accessing_files.rb +60 -0
- data/test/helpers/test_comments.rb +43 -0
- data/test/helpers/test_formulas.rb +9 -0
- data/test/helpers/test_labels.rb +103 -0
- data/test/helpers/test_sheets.rb +55 -0
- data/test/helpers/test_styles.rb +62 -0
- data/test/roo/test_base.rb +182 -0
- data/test/roo/test_csv.rb +9 -1
- data/test/roo/test_excelx.rb +151 -12
- data/test/roo/test_open_office.rb +195 -32
- data/test/test_helper.rb +53 -22
- data/test/test_roo.rb +31 -880
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 711650fb2132509af1a6df5cd4b5a3d83eaac68f
|
4
|
+
data.tar.gz: ca23282af485cfa63d4b4a761d4081841edd385c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7166103bc551a008905e6052369ed5cf714bd949d83021e3596cef8ae083fccead0faac1b28591bf28b09f977202955c4f2e92fda45a5961475eff4ea3caa93e
|
7
|
+
data.tar.gz: dc030d1d1530114289e8a420283fdf3131759ee107dfaa17bcc35c098e5d0e8b74fe984dc655b72a2701b211e3af3442f3cd79f0ad07e9cf1e7587496cfc7a16
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
+
## [2.7.1] 2017-01-03
|
4
|
+
### Fixed
|
5
|
+
- Fixed regression where a CSV's encoding was being ignored [372](https://github.com/roo-rb/roo/pull/372)
|
6
|
+
|
3
7
|
## [2.7.0] 2016-12-31
|
4
8
|
### Fixed
|
5
9
|
- Added rack server for testing Roo's download capabilities [365](https://github.com/roo-rb/roo/pull/365)
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Install as a gem
|
|
18
18
|
Or add it to your Gemfile
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
gem "roo", "~> 2.
|
21
|
+
gem "roo", "~> 2.7.0"
|
22
22
|
```
|
23
23
|
## Usage
|
24
24
|
|
@@ -266,6 +266,9 @@ Roo's public methods have stayed relatively consistent between 1.13.x and 2.0.0,
|
|
266
266
|
Roo uses Minitest and RSpec. The best of both worlds! Run `bundle exec rake` to
|
267
267
|
run the tests/examples.
|
268
268
|
|
269
|
+
You can run the tests/examples with Rspec like reporters by running
|
270
|
+
`USE_REPORTERS=true bundle exec rake`
|
271
|
+
|
269
272
|
Roo also has a few tests that take a long time (5+ seconds). To run these, use
|
270
273
|
`LONG_RUN=true bundle exec rake`
|
271
274
|
|
data/lib/roo/base.rb
CHANGED
@@ -297,12 +297,11 @@ class Roo::Base
|
|
297
297
|
end
|
298
298
|
|
299
299
|
def parse(options = {})
|
300
|
-
|
301
|
-
|
302
|
-
yield(row) if block_given?
|
303
|
-
ary << row
|
300
|
+
results = each(options).map do |row|
|
301
|
+
block_given? ? yield(row) : row
|
304
302
|
end
|
305
|
-
|
303
|
+
|
304
|
+
options[:headers] == true ? results : results.drop(1)
|
306
305
|
end
|
307
306
|
|
308
307
|
def row_with(query, return_headers = false)
|
data/lib/roo/csv.rb
CHANGED
@@ -98,7 +98,7 @@ module Roo
|
|
98
98
|
|
99
99
|
def set_row_count(sheet)
|
100
100
|
@first_row[sheet] = 1
|
101
|
-
@last_row[sheet] = ::CSV.readlines(@filename).size
|
101
|
+
@last_row[sheet] = ::CSV.readlines(@filename, csv_options).size
|
102
102
|
@last_row[sheet] = @first_row[sheet] if @last_row[sheet].zero?
|
103
103
|
|
104
104
|
nil
|
@@ -106,7 +106,7 @@ module Roo
|
|
106
106
|
|
107
107
|
def set_column_count(sheet)
|
108
108
|
@first_column[sheet] = 1
|
109
|
-
@last_column[sheet] = (::CSV.readlines(@filename).first || []).size
|
109
|
+
@last_column[sheet] = (::CSV.readlines(@filename, csv_options).first || []).size
|
110
110
|
@last_column[sheet] = @first_column[sheet] if @last_column[sheet].zero?
|
111
111
|
|
112
112
|
nil
|
data/lib/roo/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/test/formatters/test_csv.rb
CHANGED
@@ -44,7 +44,7 @@ class TestRooFormatterCSV < Minitest::Test
|
|
44
44
|
# wird.
|
45
45
|
# Besser: Methode um temporaeres Dir. portabel zu bestimmen
|
46
46
|
def test_huge_document_to_csv
|
47
|
-
|
47
|
+
skip_long_test
|
48
48
|
|
49
49
|
original_csv_path = File.join(TESTDIR, "Bibelbund.csv")
|
50
50
|
with_each_spreadsheet(name: "Bibelbund", format: [:openoffice, :excelx]) do |workbook|
|
@@ -71,7 +71,7 @@ class TestRooFormatterCSV < Minitest::Test
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_bug_quotes_excelx
|
74
|
-
|
74
|
+
skip_long_test
|
75
75
|
# TODO: run this test with a much smaller document
|
76
76
|
with_each_spreadsheet(name: "Bibelbund", format: [:openoffice, :excelx]) do |workbook|
|
77
77
|
workbook.default_sheet = workbook.sheets.first
|
data/test/formatters/test_xml.rb
CHANGED
@@ -3,20 +3,23 @@ require "test_helper"
|
|
3
3
|
class TestRooFormatterXML < Minitest::Test
|
4
4
|
def test_to_xml
|
5
5
|
expected_sheet_count = 5
|
6
|
-
|
6
|
+
options = { name: "numbers1", encoding: "utf8" }
|
7
|
+
with_each_spreadsheet(options) do |workbook|
|
7
8
|
skip if defined? JRUBY_VERSION
|
8
9
|
workbook.to_xml
|
9
10
|
sheetname = workbook.sheets.first
|
10
11
|
doc = Nokogiri::XML(workbook.to_xml)
|
11
|
-
all_cells = init_all_cells(workbook, sheetname)
|
12
12
|
|
13
13
|
assert_equal expected_sheet_count, doc.xpath("//spreadsheet/sheet").count
|
14
14
|
|
15
15
|
doc.xpath("//spreadsheet/sheet").each do |xml_sheet|
|
16
|
-
|
17
|
-
xml_sheet.children.
|
18
|
-
next unless cell.attributes["name"]
|
16
|
+
all_cells = init_all_cells(workbook, sheetname)
|
17
|
+
cells = xml_sheet.children.reject(&:text?)
|
19
18
|
|
19
|
+
assert_equal sheetname, xml_sheet.attribute("name").value
|
20
|
+
assert_equal all_cells.size, cells.size
|
21
|
+
|
22
|
+
cells.each_with_index do |cell, i|
|
20
23
|
expected = [
|
21
24
|
all_cells[i][:row],
|
22
25
|
all_cells[i][:column],
|
@@ -24,11 +27,12 @@ class TestRooFormatterXML < Minitest::Test
|
|
24
27
|
all_cells[i][:type],
|
25
28
|
]
|
26
29
|
result = [
|
27
|
-
cell.
|
28
|
-
cell.
|
29
|
-
cell.
|
30
|
-
cell.
|
30
|
+
cell.attribute("row").value,
|
31
|
+
cell.attribute("column").value,
|
32
|
+
cell.text,
|
33
|
+
cell.attribute("type").value,
|
31
34
|
]
|
35
|
+
|
32
36
|
assert_equal expected, result
|
33
37
|
end # end of sheet
|
34
38
|
sheetname = workbook.sheets[workbook.sheets.index(sheetname) + 1]
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Tests for "Accessing Files" which includes opening and closing files.
|
2
|
+
module TestAccesingFiles
|
3
|
+
def test_close
|
4
|
+
with_each_spreadsheet(name: "numbers1") do |oo|
|
5
|
+
next unless (tempdir = oo.instance_variable_get("@tmpdir"))
|
6
|
+
oo.close
|
7
|
+
refute File.exist?(tempdir), "Expected #{tempdir} to be cleaned up"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# NOTE: Ruby 2.4.0 changed the way GC works. The last Roo object created by
|
12
|
+
# with_each_spreadsheet wasn't getting GC'd until after the process
|
13
|
+
# ended.
|
14
|
+
#
|
15
|
+
# That behavior change broke this test. In order to fix it, I forked the
|
16
|
+
# process and passed the temp directories from the forked process in
|
17
|
+
# order to check if they were removed properly.
|
18
|
+
def test_finalize
|
19
|
+
skip if defined? JRUBY_VERSION
|
20
|
+
|
21
|
+
read, write = IO.pipe
|
22
|
+
pid = Process.fork do
|
23
|
+
with_each_spreadsheet(name: "numbers1") do |oo|
|
24
|
+
write.puts oo.instance_variable_get("@tmpdir")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Process.wait(pid)
|
29
|
+
write.close
|
30
|
+
tempdirs = read.read.split("\n")
|
31
|
+
read.close
|
32
|
+
|
33
|
+
refute tempdirs.empty?
|
34
|
+
tempdirs.each do |tempdir|
|
35
|
+
refute File.exist?(tempdir), "Expected #{tempdir} to be cleaned up"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_cleanup_on_error
|
40
|
+
# NOTE: This test was occasionally failing because when it started running
|
41
|
+
# other tests would have already added folders to the temp directory,
|
42
|
+
# polluting the directory. You'd end up in a situation where there
|
43
|
+
# would be less folders AFTER this ran than originally started.
|
44
|
+
#
|
45
|
+
# Instead, just use a custom temp directory to test the functionality.
|
46
|
+
ENV["ROO_TMP"] = Dir.tmpdir + "/test_cleanup_on_error"
|
47
|
+
Dir.mkdir(ENV["ROO_TMP"]) unless File.exist?(ENV["ROO_TMP"])
|
48
|
+
expected_dir_contents = Dir.open(ENV["ROO_TMP"]).to_a
|
49
|
+
with_each_spreadsheet(name: "non_existent_file", ignore_errors: true) {}
|
50
|
+
|
51
|
+
assert_equal expected_dir_contents, Dir.open(ENV["ROO_TMP"]).to_a
|
52
|
+
Dir.rmdir ENV["ROO_TMP"] if File.exist?(ENV["ROO_TMP"])
|
53
|
+
ENV.delete "ROO_TMP"
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_name_with_leading_slash
|
57
|
+
xlsx = Roo::Excelx.new(File.join(TESTDIR, "/name_with_leading_slash.xlsx"))
|
58
|
+
assert_equal 1, xlsx.sheets.count
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module TestComments
|
2
|
+
def test_comment
|
3
|
+
options = { name: "comments", format: [:openoffice, :libreoffice, :excelx] }
|
4
|
+
with_each_spreadsheet(options) do |oo|
|
5
|
+
assert_equal "Kommentar fuer B4", oo.comment("b", 4)
|
6
|
+
assert_equal "Kommentar fuer B5", oo.comment("b", 5)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_no_comment
|
11
|
+
options = { name: "comments", format: [:openoffice, :excelx] }
|
12
|
+
with_each_spreadsheet(options) do |oo|
|
13
|
+
# There are no comments at the second sheet.
|
14
|
+
assert_nil oo.comment("b", 4, oo.sheets[1])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_comments
|
19
|
+
options = { name: "comments", format: [:openoffice, :libreoffice, :excelx] }
|
20
|
+
expexted_comments = [
|
21
|
+
[4, 2, "Kommentar fuer B4"],
|
22
|
+
[5, 2, "Kommentar fuer B5"],
|
23
|
+
]
|
24
|
+
|
25
|
+
with_each_spreadsheet(options) do |oo|
|
26
|
+
assert_equal expexted_comments, oo.comments(oo.sheets.first), "comments error in class #{oo.class}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_empty_sheet_comments
|
31
|
+
options = { name: "emptysheets", format: [:openoffice, :excelx] }
|
32
|
+
with_each_spreadsheet(options) do |oo|
|
33
|
+
assert_equal [], oo.comments, "An empty sheet's formulas should be an empty array"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_comments_from_google_sheet_exported_as_xlsx
|
38
|
+
expected_comments = [[1, 1, "this is a comment\n\t-Steven Daniels"]]
|
39
|
+
with_each_spreadsheet(name: "comments-google", format: [:excelx]) do |oo|
|
40
|
+
assert_equal expected_comments, oo.comments(oo.sheets.first), "comments error in class #{oo.class}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module TestFormulas
|
2
|
+
def test_empty_sheet_formulas
|
3
|
+
options = { name: "emptysheets", format: [:openoffice, :excelx] }
|
4
|
+
with_each_spreadsheet(options) do |oo|
|
5
|
+
oo.default_sheet = oo.sheets.first
|
6
|
+
assert_equal [], oo.formulas, "An empty sheet's formulas should be an empty array"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module TestLabels
|
2
|
+
def test_labels
|
3
|
+
options = { name: "named_cells", format: [:openoffice, :excelx, :libreoffice] }
|
4
|
+
expected_labels = [
|
5
|
+
["anton", [5, 3, "Sheet1"]],
|
6
|
+
["berta", [4, 2, "Sheet1"]],
|
7
|
+
["caesar", [7, 2, "Sheet1"]],
|
8
|
+
]
|
9
|
+
with_each_spreadsheet(options) do |oo|
|
10
|
+
assert_equal expected_labels, oo.labels, "error with labels array in class #{oo.class}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_labeled_cells
|
15
|
+
options = { name: "named_cells", format: [:openoffice, :excelx, :libreoffice] }
|
16
|
+
with_each_spreadsheet(options) do |oo|
|
17
|
+
oo.default_sheet = oo.sheets.first
|
18
|
+
begin
|
19
|
+
row, col = oo.label("anton")
|
20
|
+
rescue ArgumentError
|
21
|
+
puts "labels error at #{oo.class}"
|
22
|
+
raise
|
23
|
+
end
|
24
|
+
assert_equal 5, row
|
25
|
+
assert_equal 3, col
|
26
|
+
|
27
|
+
row, col = oo.label("anton")
|
28
|
+
assert_equal "Anton", oo.cell(row, col)
|
29
|
+
|
30
|
+
row, col = oo.label("berta")
|
31
|
+
assert_equal "Bertha", oo.cell(row, col)
|
32
|
+
|
33
|
+
row, col = oo.label("caesar")
|
34
|
+
assert_equal "Cäsar", oo.cell(row, col)
|
35
|
+
|
36
|
+
row, col = oo.label("never")
|
37
|
+
assert_nil row
|
38
|
+
assert_nil col
|
39
|
+
|
40
|
+
row, col, sheet = oo.label("anton")
|
41
|
+
assert_equal 5, row
|
42
|
+
assert_equal 3, col
|
43
|
+
assert_equal "Sheet1", sheet
|
44
|
+
|
45
|
+
assert_equal "Anton", oo.anton
|
46
|
+
assert_raises(NoMethodError) do
|
47
|
+
row, col = oo.never
|
48
|
+
end
|
49
|
+
|
50
|
+
# Reihenfolge row, col,sheet analog zu #label
|
51
|
+
expected_labels = [
|
52
|
+
["anton", [5, 3, "Sheet1"]],
|
53
|
+
["berta", [4, 2, "Sheet1"]],
|
54
|
+
["caesar", [7, 2, "Sheet1"]],
|
55
|
+
]
|
56
|
+
assert_equal expected_labels, oo.labels, "error with labels array in class #{oo.class}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_label
|
61
|
+
options = { name: "named_cells", format: [:openoffice, :excelx, :libreoffice] }
|
62
|
+
with_each_spreadsheet(options) do |oo|
|
63
|
+
begin
|
64
|
+
row, col = oo.label("anton")
|
65
|
+
rescue ArgumentError
|
66
|
+
puts "labels error at #{oo.class}"
|
67
|
+
raise
|
68
|
+
end
|
69
|
+
|
70
|
+
assert_equal 5, row, "error with label in class #{oo.class}"
|
71
|
+
assert_equal 3, col, "error with label in class #{oo.class}"
|
72
|
+
|
73
|
+
row, col = oo.label("anton")
|
74
|
+
assert_equal "Anton", oo.cell(row, col), "error with label in class #{oo.class}"
|
75
|
+
|
76
|
+
row, col = oo.label("berta")
|
77
|
+
assert_equal "Bertha", oo.cell(row, col), "error with label in class #{oo.class}"
|
78
|
+
|
79
|
+
row, col = oo.label("caesar")
|
80
|
+
assert_equal "Cäsar", oo.cell(row, col), "error with label in class #{oo.class}"
|
81
|
+
|
82
|
+
row, col = oo.label("never")
|
83
|
+
assert_nil row
|
84
|
+
assert_nil col
|
85
|
+
|
86
|
+
row, col, sheet = oo.label("anton")
|
87
|
+
assert_equal 5, row
|
88
|
+
assert_equal 3, col
|
89
|
+
assert_equal "Sheet1", sheet
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_method_missing_anton
|
94
|
+
options = { name: "named_cells", format: [:openoffice, :excelx, :libreoffice] }
|
95
|
+
with_each_spreadsheet(options) do |oo|
|
96
|
+
# oo.default_sheet = oo.sheets.first
|
97
|
+
assert_equal "Anton", oo.anton
|
98
|
+
assert_raises(NoMethodError) do
|
99
|
+
oo.never
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# NOTE: Putting these tests into modules in order to share them across different
|
2
|
+
# test classes, i.e. both TestRooExcelx and TestRooOpenOffice should run
|
3
|
+
# sheet related tests.
|
4
|
+
#
|
5
|
+
# This will allow me to reuse these test cases when I add new classes for
|
6
|
+
# Roo's future API.
|
7
|
+
# Sheet related tests
|
8
|
+
module TestSheets
|
9
|
+
def test_sheets
|
10
|
+
sheet_names = ["Tabelle1", "Name of Sheet 2", "Sheet3", "Sheet4", "Sheet5"]
|
11
|
+
with_each_spreadsheet(name: "numbers1") do |oo|
|
12
|
+
assert_equal sheet_names, oo.sheets
|
13
|
+
assert_raises(RangeError) { oo.default_sheet = "no_sheet" }
|
14
|
+
assert_raises(TypeError) { oo.default_sheet = [1, 2, 3] }
|
15
|
+
oo.sheets.each do |sheet_name|
|
16
|
+
oo.default_sheet = sheet_name
|
17
|
+
assert_equal sheet_name, oo.default_sheet
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_sheetname
|
23
|
+
bad_sheet_name = "non existing sheet name"
|
24
|
+
with_each_spreadsheet(name: "numbers1") do |oo|
|
25
|
+
oo.default_sheet = "Name of Sheet 2"
|
26
|
+
assert_equal "I am sheet 2", oo.cell("C", 5)
|
27
|
+
assert_raises(RangeError) { oo.default_sheet = bad_sheet_name }
|
28
|
+
assert_raises(RangeError) { oo.default_sheet = bad_sheet_name }
|
29
|
+
assert_raises(RangeError) { oo.cell("C", 5, bad_sheet_name) }
|
30
|
+
assert_raises(RangeError) { oo.celltype("C", 5, bad_sheet_name) }
|
31
|
+
assert_raises(RangeError) { oo.empty?("C", 5, bad_sheet_name) }
|
32
|
+
assert_raises(RangeError) { oo.formula?("C", 5, bad_sheet_name) }
|
33
|
+
assert_raises(RangeError) { oo.formula("C", 5, bad_sheet_name) }
|
34
|
+
assert_raises(RangeError) { oo.set("C", 5, 42, bad_sheet_name) }
|
35
|
+
assert_raises(RangeError) { oo.formulas(bad_sheet_name) }
|
36
|
+
assert_raises(RangeError) { oo.to_yaml({}, 1, 1, 1, 1, bad_sheet_name) }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_info_doesnt_set_default_sheet
|
41
|
+
sheet_name = "Sheet3"
|
42
|
+
with_each_spreadsheet(name: "numbers1") do |oo|
|
43
|
+
oo.default_sheet = sheet_name
|
44
|
+
oo.info
|
45
|
+
assert_equal sheet_name, oo.default_sheet
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_bug_numbered_sheet_names
|
50
|
+
options = { name: "bug-numbered-sheet-names", format: :excelx }
|
51
|
+
with_each_spreadsheet(options) do |oo|
|
52
|
+
oo.each_with_pagename {}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module TestStyles
|
2
|
+
def test_cell_styles
|
3
|
+
# styles only valid in excel spreadsheets?
|
4
|
+
# TODO: what todo with other spreadsheet types
|
5
|
+
with_each_spreadsheet(name: "style", format: [:excelx]) do |oo|
|
6
|
+
# bold
|
7
|
+
assert_equal true, oo.font(1, 1).bold?
|
8
|
+
assert_equal false, oo.font(1, 1).italic?
|
9
|
+
assert_equal false, oo.font(1, 1).underline?
|
10
|
+
|
11
|
+
# italic
|
12
|
+
assert_equal false, oo.font(2, 1).bold?
|
13
|
+
assert_equal true, oo.font(2, 1).italic?
|
14
|
+
assert_equal false, oo.font(2, 1).underline?
|
15
|
+
|
16
|
+
# normal
|
17
|
+
assert_equal false, oo.font(3, 1).bold?
|
18
|
+
assert_equal false, oo.font(3, 1).italic?
|
19
|
+
assert_equal false, oo.font(3, 1).underline?
|
20
|
+
|
21
|
+
# underline
|
22
|
+
assert_equal false, oo.font(4, 1).bold?
|
23
|
+
assert_equal false, oo.font(4, 1).italic?
|
24
|
+
assert_equal true, oo.font(4, 1).underline?
|
25
|
+
|
26
|
+
# bold italic
|
27
|
+
assert_equal true, oo.font(5, 1).bold?
|
28
|
+
assert_equal true, oo.font(5, 1).italic?
|
29
|
+
assert_equal false, oo.font(5, 1).underline?
|
30
|
+
|
31
|
+
# bold underline
|
32
|
+
assert_equal true, oo.font(6, 1).bold?
|
33
|
+
assert_equal false, oo.font(6, 1).italic?
|
34
|
+
assert_equal true, oo.font(6, 1).underline?
|
35
|
+
|
36
|
+
# italic underline
|
37
|
+
assert_equal false, oo.font(7, 1).bold?
|
38
|
+
assert_equal true, oo.font(7, 1).italic?
|
39
|
+
assert_equal true, oo.font(7, 1).underline?
|
40
|
+
|
41
|
+
# bolded row
|
42
|
+
assert_equal true, oo.font(8, 1).bold?
|
43
|
+
assert_equal false, oo.font(8, 1).italic?
|
44
|
+
assert_equal false, oo.font(8, 1).underline?
|
45
|
+
|
46
|
+
# bolded col
|
47
|
+
assert_equal true, oo.font(9, 2).bold?
|
48
|
+
assert_equal false, oo.font(9, 2).italic?
|
49
|
+
assert_equal false, oo.font(9, 2).underline?
|
50
|
+
|
51
|
+
# bolded row, italic col
|
52
|
+
assert_equal true, oo.font(10, 3).bold?
|
53
|
+
assert_equal true, oo.font(10, 3).italic?
|
54
|
+
assert_equal false, oo.font(10, 3).underline?
|
55
|
+
|
56
|
+
# normal
|
57
|
+
assert_equal false, oo.font(11, 4).bold?
|
58
|
+
assert_equal false, oo.font(11, 4).italic?
|
59
|
+
assert_equal false, oo.font(11, 4).underline?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|