spreadsheet 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/spreadsheet.rb +1 -1
- data/lib/spreadsheet/excel/writer/worksheet.rb +8 -4
- data/test/excel/writer/worksheet.rb +43 -28
- metadata +4 -4
data/History.txt
CHANGED
data/lib/spreadsheet.rb
CHANGED
@@ -756,14 +756,18 @@ and minimal code that generates this warning. Thanks!
|
|
756
756
|
else
|
757
757
|
height * TWIPS
|
758
758
|
end
|
759
|
-
|
760
|
-
|
759
|
+
|
760
|
+
attrs = [
|
761
761
|
row.idx,
|
762
762
|
row.first_used,
|
763
763
|
row.first_unused,
|
764
764
|
height,
|
765
|
-
opts
|
766
|
-
|
765
|
+
opts]
|
766
|
+
|
767
|
+
return if attrs.any?(&:nil?)
|
768
|
+
|
769
|
+
# TODO: Row spacing
|
770
|
+
data = attrs.pack binfmt(:row)
|
767
771
|
write_op opcode(:row), data
|
768
772
|
end
|
769
773
|
def write_rowblock block
|
@@ -7,34 +7,49 @@ require 'spreadsheet/excel/writer/worksheet'
|
|
7
7
|
module Spreadsheet
|
8
8
|
module Excel
|
9
9
|
module Writer
|
10
|
-
class TestWorksheet < Test::Unit::TestCase
|
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
|
-
|
10
|
+
class TestWorksheet < Test::Unit::TestCase
|
11
|
+
def test_need_number
|
12
|
+
sheet = Worksheet.new nil, nil
|
13
|
+
assert_equal false, sheet.need_number?(10)
|
14
|
+
assert_equal false, sheet.need_number?(114.55)
|
15
|
+
assert_equal false, sheet.need_number?(0.1)
|
16
|
+
assert_equal false, sheet.need_number?(0.01)
|
17
|
+
assert_equal false, sheet.need_number?(0 / 0.0) # NaN
|
18
|
+
assert_equal true, sheet.need_number?(0.001)
|
19
|
+
assert_equal true, sheet.need_number?(10000000.0)
|
20
|
+
end
|
21
|
+
|
22
|
+
class RowMock
|
23
|
+
attr_accessor :idx, :first_used, :first_unused, :height, :outline_level
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@idx, @first_used, @first_unused, @height, @outline_level = 0,0,0,0,1
|
27
|
+
end
|
28
|
+
|
29
|
+
def method_missing name, *args
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_write_row_should_not_write_if_the_row_has_no_used_columns
|
35
|
+
sheet = Worksheet.new nil, nil
|
36
|
+
row = RowMock.new
|
37
|
+
row.first_used = nil
|
38
|
+
|
39
|
+
sheet.write_row row
|
40
|
+
|
41
|
+
assert_equal '', sheet.data
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_write_row_should_write_if_any_column_is_used
|
45
|
+
sheet = Worksheet.new nil, nil
|
46
|
+
row = RowMock.new
|
47
|
+
|
48
|
+
sheet.write_row row
|
49
|
+
|
50
|
+
assert_equal false, sheet.data.empty?
|
51
|
+
end
|
52
|
+
end
|
38
53
|
end
|
39
54
|
end
|
40
55
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 8
|
10
|
+
version: 0.6.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: ruby-ole
|