roo 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Manifest.txt +2 -0
- data/lib/roo/excel.rb +89 -102
- data/lib/roo/excelx.rb +14 -18
- data/lib/roo/generic_spreadsheet.rb +29 -7
- data/lib/roo/google.rb +2 -0
- data/lib/roo/openoffice.rb +33 -16
- data/lib/roo/version.rb +1 -1
- data/test/datetime.ods +0 -0
- data/test/datetime.xls +0 -0
- data/test/test_helper.rb +1 -1
- data/test/test_roo.rb +754 -227
- data/website/index.html +29 -10
- data/website/index.txt +7 -1
- metadata +6 -4
data/test/test_roo.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#damit keine falschen Vermutungen aufkommen: Ich habe religioes rein gar nichts
|
2
2
|
# mit diesem Bibelbund zu tun, aber die hatten eine ziemlich grosse
|
3
|
-
# Spreadsheet-Datei mit ca. 3500 Zeilen oeffentlich im Netz, die sich ganz gut
|
3
|
+
# Spreadsheet-Datei mit ca. 3500 Zeilen oeffentlich im Netz, die sich ganz gut
|
4
4
|
# zum Testen eignete.
|
5
5
|
#
|
6
6
|
#--
|
@@ -13,11 +13,9 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
13
13
|
require 'fileutils'
|
14
14
|
require 'timeout'
|
15
15
|
require 'logger'
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
#$log = Logger.new(File.join(ENV['HOME'],"roo.log"))
|
17
|
+
#$log.level = Logger::WARN
|
18
|
+
#$log.level = Logger::DEBUG
|
21
19
|
|
22
20
|
DISPLAY_LOG = false
|
23
21
|
DB_LOG = false
|
@@ -72,6 +70,7 @@ class Test::Unit::TestCase
|
|
72
70
|
#RAILS_DEFAULT_LOGGER.debug "RUNNING #{self.class} #{@method_name} \t#{Time.now.to_s}"
|
73
71
|
if DISPLAY_LOG
|
74
72
|
print "RUNNING #{self.class} #{@method_name} \t#{Time.now.to_s}"
|
73
|
+
STDOUT.flush
|
75
74
|
end
|
76
75
|
unlogged_run result, &block
|
77
76
|
t2 = Time.now
|
@@ -107,20 +106,20 @@ end
|
|
107
106
|
class TestRoo < Test::Unit::TestCase
|
108
107
|
|
109
108
|
OPENOFFICE = true # do Openoffice-Spreadsheet Tests?
|
110
|
-
EXCEL = true
|
109
|
+
EXCEL = true # do Excel Tests?
|
111
110
|
GOOGLE = false # do Google-Spreadsheet Tests?
|
112
111
|
GNUMERIC_ODS = false # do gnumeric with ods files Tests?
|
113
112
|
EXCELX = true # do Excel-X Tests? (.xlsx-files)
|
114
113
|
|
115
114
|
OPENOFFICEWRITE = false # experimental: write access with OO-Documents
|
116
115
|
ONLINE = false
|
117
|
-
LONG_RUN =
|
118
|
-
GLOBAL_TIMEOUT =
|
116
|
+
LONG_RUN = false
|
117
|
+
GLOBAL_TIMEOUT = 48.minutes #*60 # 2*12*60 # seconds
|
119
118
|
|
120
119
|
def setup
|
121
|
-
if DISPLAY_LOG
|
122
|
-
|
123
|
-
end
|
120
|
+
#if DISPLAY_LOG
|
121
|
+
# puts " GLOBAL_TIMEOUT = #{GLOBAL_TIMEOUT}"
|
122
|
+
#end
|
124
123
|
end
|
125
124
|
|
126
125
|
def test_internal_minutes
|
@@ -247,7 +246,7 @@ class TestRoo < Test::Unit::TestCase
|
|
247
246
|
}
|
248
247
|
end
|
249
248
|
end
|
250
|
-
|
249
|
+
|
251
250
|
def test_sheets_google
|
252
251
|
if GOOGLE
|
253
252
|
oo = Google.new(key_of("numbers1"))
|
@@ -386,7 +385,7 @@ class TestRoo < Test::Unit::TestCase
|
|
386
385
|
if EXCELX
|
387
386
|
oo = Excelx.new(File.join("test","numbers1.xlsx"))
|
388
387
|
oo.default_sheet = oo.sheets.first
|
389
|
-
|
388
|
+
|
390
389
|
assert_kind_of Float, oo.cell(1,1)
|
391
390
|
assert_equal 1, oo.cell(1,1)
|
392
391
|
assert_equal 2, oo.cell(1,2)
|
@@ -422,7 +421,7 @@ class TestRoo < Test::Unit::TestCase
|
|
422
421
|
assert_equal "1961-11-21", oo.cell(5,1).to_s
|
423
422
|
end
|
424
423
|
end
|
425
|
-
|
424
|
+
|
426
425
|
def test_cell_google
|
427
426
|
if GOOGLE
|
428
427
|
oo = Google.new(key_of("numbers1"))
|
@@ -644,7 +643,7 @@ class TestRoo < Test::Unit::TestCase
|
|
644
643
|
# google does not have a officeversion
|
645
644
|
end
|
646
645
|
end
|
647
|
-
|
646
|
+
|
648
647
|
#TODO: inkonsequente Lieferung Fixnum/Float
|
649
648
|
def test_rows
|
650
649
|
if OPENOFFICE
|
@@ -944,7 +943,7 @@ class TestRoo < Test::Unit::TestCase
|
|
944
943
|
oo = Openoffice.new(File.join("test","gnumeric_numbers1.ods"))
|
945
944
|
oo.default_sheet = "Name of Sheet 2"
|
946
945
|
assert_equal 'I am sheet 2', oo.cell('C',5)
|
947
|
-
assert_raise(RangeError) {
|
946
|
+
assert_raise(RangeError) {
|
948
947
|
oo.default_sheet = "non existing sheet name"
|
949
948
|
}
|
950
949
|
assert_raise(RangeError) { oo.default_sheet = "non existing sheet name" }
|
@@ -961,7 +960,7 @@ class TestRoo < Test::Unit::TestCase
|
|
961
960
|
oo = Excel.new(File.join("test","numbers1.xls"))
|
962
961
|
oo.default_sheet = "Name of Sheet 2"
|
963
962
|
assert_equal 'I am sheet 2', oo.cell('C',5)
|
964
|
-
assert_raise(RangeError) {
|
963
|
+
assert_raise(RangeError) {
|
965
964
|
oo.default_sheet = "non existing sheet name"
|
966
965
|
}
|
967
966
|
assert_raise(RangeError) { oo.default_sheet = "non existing sheet name" }
|
@@ -978,7 +977,7 @@ class TestRoo < Test::Unit::TestCase
|
|
978
977
|
oo = Excelx.new(File.join("test","numbers1.xlsx"))
|
979
978
|
oo.default_sheet = "Name of Sheet 2"
|
980
979
|
assert_equal 'I am sheet 2', oo.cell('C',5)
|
981
|
-
assert_raise(RangeError) {
|
980
|
+
assert_raise(RangeError) {
|
982
981
|
oo.default_sheet = "non existing sheet name"
|
983
982
|
}
|
984
983
|
assert_raise(RangeError) { oo.default_sheet = "non existing sheet name" }
|
@@ -995,7 +994,7 @@ class TestRoo < Test::Unit::TestCase
|
|
995
994
|
oo = Google.new(key_of("numbers1"))
|
996
995
|
oo.default_sheet = "Name of Sheet 2"
|
997
996
|
assert_equal 'I am sheet 2', oo.cell('C',5)
|
998
|
-
assert_raise(RangeError) {
|
997
|
+
assert_raise(RangeError) {
|
999
998
|
oo.default_sheet = "non existing sheet name"
|
1000
999
|
}
|
1001
1000
|
assert_raise(RangeError) { oo.default_sheet = "non existing sheet name" }
|
@@ -1277,7 +1276,7 @@ class TestRoo < Test::Unit::TestCase
|
|
1277
1276
|
end
|
1278
1277
|
if EXCELX
|
1279
1278
|
oo = Excelx.new(File.join("test","numbers1.xlsx"))
|
1280
|
-
oo.default_sheet = oo.sheets[5-1]
|
1279
|
+
oo.default_sheet = "Sheet5" # oo.sheets[5-1]
|
1281
1280
|
assert_equal 1, oo.cell('A',1)
|
1282
1281
|
assert_equal 5, oo.cell('b',1)
|
1283
1282
|
assert_equal 5, oo.cell('c',1)
|
@@ -1969,11 +1968,16 @@ class TestRoo < Test::Unit::TestCase
|
|
1969
1968
|
end
|
1970
1969
|
end
|
1971
1970
|
end
|
1972
|
-
|
1971
|
+
|
1973
1972
|
def test_excel_zipped
|
1974
1973
|
if EXCEL
|
1975
1974
|
excel = Excel.new(File.join("test","bode-v1.xls.zip"), :zip)
|
1976
1975
|
assert excel
|
1976
|
+
# muss Fehler bringen, weil kein default_sheet gesetzt wurde
|
1977
|
+
assert_raises (ArgumentError) {
|
1978
|
+
assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5)
|
1979
|
+
}
|
1980
|
+
excel.default_sheet = excel.sheets.first
|
1977
1981
|
assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5)
|
1978
1982
|
excel.remove_tmp # don't forget to remove the temporary files
|
1979
1983
|
end
|
@@ -1986,6 +1990,10 @@ class TestRoo < Test::Unit::TestCase
|
|
1986
1990
|
# diese Datei gibt es noch nicht gezippt
|
1987
1991
|
excel = Excelx.new(File.join("test","bode-v1.xlsx.zip"), :zip)
|
1988
1992
|
assert excel
|
1993
|
+
assert_raises (ArgumentError) {
|
1994
|
+
assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5)
|
1995
|
+
}
|
1996
|
+
excel.default_sheet = excel.sheets.first
|
1989
1997
|
assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5)
|
1990
1998
|
excel.remove_tmp # don't forget to remove the temporary files
|
1991
1999
|
end
|
@@ -1996,6 +2004,11 @@ class TestRoo < Test::Unit::TestCase
|
|
1996
2004
|
if OPENOFFICE
|
1997
2005
|
oo = Openoffice.new(File.join("test","bode-v1.ods.zip"), :zip)
|
1998
2006
|
assert oo
|
2007
|
+
# muss Fehler bringen, weil kein default_sheet gesetzt wurde
|
2008
|
+
assert_raises (ArgumentError) {
|
2009
|
+
assert_equal 'ist "e" im Nenner von H(s)', oo.cell('b', 5)
|
2010
|
+
|
2011
|
+
}
|
1999
2012
|
oo.default_sheet = oo.sheets.first
|
2000
2013
|
assert_equal 'ist "e" im Nenner von H(s)', oo.cell('b', 5)
|
2001
2014
|
oo.remove_tmp # don't forget to remove the temporary files
|
@@ -2225,7 +2238,7 @@ class TestRoo < Test::Unit::TestCase
|
|
2225
2238
|
#}
|
2226
2239
|
end
|
2227
2240
|
end
|
2228
|
-
|
2241
|
+
|
2229
2242
|
def test_to_csv_google
|
2230
2243
|
# maybe a better example... TODO:
|
2231
2244
|
if GOOGLE
|
@@ -2396,8 +2409,11 @@ class TestRoo < Test::Unit::TestCase
|
|
2396
2409
|
assert_equal "ABC", oo.cell('E',6,sheetname)
|
2397
2410
|
oo.reload
|
2398
2411
|
end
|
2399
|
-
end
|
2412
|
+
end # OPENOFFICE
|
2413
|
+
|
2414
|
+
|
2400
2415
|
if EXCEL
|
2416
|
+
$debug = true
|
2401
2417
|
oo = Excel.new(File.join("test","numbers1.xls"))
|
2402
2418
|
2.times do
|
2403
2419
|
oo.default_sheet = "Tabelle1"
|
@@ -2436,8 +2452,9 @@ class TestRoo < Test::Unit::TestCase
|
|
2436
2452
|
assert_equal "ABC", oo.cell('D',6,sheetname)
|
2437
2453
|
assert_equal "ABC", oo.cell('E',6,sheetname)
|
2438
2454
|
oo.reload
|
2439
|
-
end
|
2440
|
-
|
2455
|
+
end # times
|
2456
|
+
$debug = false
|
2457
|
+
end # EXCEL
|
2441
2458
|
if GOOGLE
|
2442
2459
|
oo = Google.new(key_of("numbers1"))
|
2443
2460
|
2.times do
|
@@ -2522,6 +2539,7 @@ class TestRoo < Test::Unit::TestCase
|
|
2522
2539
|
end
|
2523
2540
|
end
|
2524
2541
|
|
2542
|
+
|
2525
2543
|
def test_bug_empty_sheet_openoffice
|
2526
2544
|
if OPENOFFICE
|
2527
2545
|
oo = Openoffice.new(File.join("test","formula.ods"))
|
@@ -2532,7 +2550,7 @@ class TestRoo < Test::Unit::TestCase
|
|
2532
2550
|
assert_equal "", `cat /tmp/emptysheet.csv`
|
2533
2551
|
end
|
2534
2552
|
end
|
2535
|
-
|
2553
|
+
|
2536
2554
|
def test_bug_empty_sheet_excelx
|
2537
2555
|
if EXCELX
|
2538
2556
|
oo = Excelx.new(File.join("test","formula.xlsx"))
|
@@ -2543,7 +2561,7 @@ class TestRoo < Test::Unit::TestCase
|
|
2543
2561
|
assert_equal "", `cat /tmp/emptysheet.csv`
|
2544
2562
|
end
|
2545
2563
|
end
|
2546
|
-
|
2564
|
+
|
2547
2565
|
def test_find_by_row_huge_document_openoffice
|
2548
2566
|
if LONG_RUN
|
2549
2567
|
if OPENOFFICE
|
@@ -3013,13 +3031,16 @@ class TestRoo < Test::Unit::TestCase
|
|
3013
3031
|
end
|
3014
3032
|
|
3015
3033
|
def test_column_openoffice
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3034
|
+
after Date.new(2008,9,30) do
|
3035
|
+
|
3036
|
+
expected = [1.0,5.0,nil,10.0,Date.new(1961,11,21),'tata',nil,nil,nil,nil,'thisisa11',41.0,nil,nil,41.0,'einundvierzig',nil,Date.new(2007,5,31)]
|
3037
|
+
if OPENOFFICE
|
3038
|
+
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
3039
|
+
oo = Openoffice.new(File.join('test','numbers1.ods'))
|
3040
|
+
oo.default_sheet = oo.sheets.first
|
3041
|
+
assert_equal expected, oo.column(1)
|
3042
|
+
assert_equal expected, oo.column('a')
|
3043
|
+
end
|
3023
3044
|
end
|
3024
3045
|
end
|
3025
3046
|
end
|
@@ -3137,6 +3158,7 @@ class TestRoo < Test::Unit::TestCase
|
|
3137
3158
|
|
3138
3159
|
def test_simple_spreadsheet_find_by_condition_excel
|
3139
3160
|
if EXCEL
|
3161
|
+
$debug = true
|
3140
3162
|
oo = Excel.new(File.join("test","simple_spreadsheet.xls"))
|
3141
3163
|
oo.default_sheet = oo.sheets.first
|
3142
3164
|
oo.header_line = 3
|
@@ -3148,22 +3170,23 @@ class TestRoo < Test::Unit::TestCase
|
|
3148
3170
|
#cannot be tested because excel cannot return the result of formulas:
|
3149
3171
|
# assert_equal 1.75 , erg[1]['Sum']
|
3150
3172
|
assert_equal "Task 1" , erg[1]['Comment']
|
3173
|
+
$debug = false
|
3151
3174
|
end
|
3152
3175
|
end
|
3153
3176
|
|
3154
3177
|
def test_simple_spreadsheet_find_by_condition_excelx
|
3155
3178
|
if EXCELX
|
3156
|
-
# die dezimalen Seiten bekomme ich seltsamerweise als Date
|
3179
|
+
# die dezimalen Seiten bekomme ich seltsamerweise als Date
|
3157
3180
|
oo = Excelx.new(File.join("test","simple_spreadsheet.xlsx"))
|
3158
3181
|
oo.default_sheet = oo.sheets.first
|
3159
3182
|
oo.header_line = 3
|
3160
3183
|
erg = oo.find(:all, :conditions => {'Comment' => 'Task 1'})
|
3161
3184
|
#expected = { "Start time"=>10.75,
|
3162
|
-
# "Pause"=>0.0,
|
3163
|
-
# "Sum" => 1.75,
|
3164
|
-
# "End time" => 12.5,
|
3185
|
+
# "Pause"=>0.0,
|
3186
|
+
# "Sum" => 1.75,
|
3187
|
+
# "End time" => 12.5,
|
3165
3188
|
# "Pause" => 0.0,
|
3166
|
-
# "Sum"=> 1.75,
|
3189
|
+
# "Sum"=> 1.75,
|
3167
3190
|
# "Comment" => "Task 1",
|
3168
3191
|
# "Date" => Date.new(2007,5,7)}
|
3169
3192
|
assert_equal Date.new(2007,5,7), erg[1]['Date']
|
@@ -3219,12 +3242,25 @@ class TestRoo < Test::Unit::TestCase
|
|
3219
3242
|
end
|
3220
3243
|
|
3221
3244
|
def test_bug_false_borders_with_formulas
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3245
|
+
if EXCEL
|
3246
|
+
after Date.new(2008,9,15) do
|
3247
|
+
ex = Excel.new(File.join('test','false_encoding.xls'))
|
3248
|
+
ex.default_sheet = ex.sheets.first
|
3249
|
+
#assert_equal 1, ex.first_row
|
3250
|
+
=begin
|
3251
|
+
korrigiert auf Zeile 2. Zeile 1 enthaelt nur Formeln, die in parseexcel nicht
|
3252
|
+
ausgewertet werden koennen. D. h. der Nutzer hat keinen Vorteil davon, wenn
|
3253
|
+
er von Zeile 1 ab iterieren kann, da er auf die Formeln sowieso nicht zugreifen
|
3254
|
+
kann. Ideal waere aber noch eine Loesung, die auch diese Zeilen bei Excel
|
3255
|
+
als nichtleere Zeile liefert.
|
3256
|
+
TODO:
|
3257
|
+
=end
|
3258
|
+
assert_equal 2, ex.first_row
|
3259
|
+
assert_equal 3, ex.last_row
|
3260
|
+
assert_equal 1, ex.first_column
|
3261
|
+
assert_equal 4, ex.last_column
|
3262
|
+
end
|
3263
|
+
end
|
3228
3264
|
end
|
3229
3265
|
|
3230
3266
|
def test_fe
|
@@ -3325,32 +3361,34 @@ class TestRoo < Test::Unit::TestCase
|
|
3325
3361
|
end
|
3326
3362
|
|
3327
3363
|
def test_bug_excel_numbers1_sheet5_last_row
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3341
|
-
|
3342
|
-
|
3343
|
-
|
3344
|
-
|
3345
|
-
|
3346
|
-
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3353
|
-
|
3364
|
+
if EXCEL
|
3365
|
+
oo = Excel.new(File.join("test","numbers1.xls"))
|
3366
|
+
oo.default_sheet = "Tabelle1"
|
3367
|
+
assert_equal 1, oo.first_row
|
3368
|
+
assert_equal 18, oo.last_row
|
3369
|
+
assert_equal Openoffice.letter_to_number('A'), oo.first_column
|
3370
|
+
assert_equal Openoffice.letter_to_number('G'), oo.last_column
|
3371
|
+
oo.default_sheet = "Name of Sheet 2"
|
3372
|
+
assert_equal 5, oo.first_row
|
3373
|
+
assert_equal 14, oo.last_row
|
3374
|
+
assert_equal Openoffice.letter_to_number('B'), oo.first_column
|
3375
|
+
assert_equal Openoffice.letter_to_number('E'), oo.last_column
|
3376
|
+
oo.default_sheet = "Sheet3"
|
3377
|
+
assert_equal 1, oo.first_row
|
3378
|
+
assert_equal 1, oo.last_row
|
3379
|
+
assert_equal Openoffice.letter_to_number('A'), oo.first_column
|
3380
|
+
assert_equal Openoffice.letter_to_number('BA'), oo.last_column
|
3381
|
+
oo.default_sheet = "Sheet4"
|
3382
|
+
assert_equal 1, oo.first_row
|
3383
|
+
assert_equal 1, oo.last_row
|
3384
|
+
assert_equal Openoffice.letter_to_number('A'), oo.first_column
|
3385
|
+
assert_equal Openoffice.letter_to_number('E'), oo.last_column
|
3386
|
+
oo.default_sheet = "Sheet5"
|
3387
|
+
assert_equal 1, oo.first_row
|
3388
|
+
assert_equal 6, oo.last_row
|
3389
|
+
assert_equal Openoffice.letter_to_number('A'), oo.first_column
|
3390
|
+
assert_equal Openoffice.letter_to_number('E'), oo.last_column
|
3391
|
+
end
|
3354
3392
|
end
|
3355
3393
|
|
3356
3394
|
def test_should_raise_file_not_found_error
|
@@ -3467,9 +3505,10 @@ Sheet 3:
|
|
3467
3505
|
end
|
3468
3506
|
|
3469
3507
|
def test_bug_bbu_excel
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3508
|
+
if EXCEL
|
3509
|
+
oo = Excel.new(File.join('test','bbu.xls'))
|
3510
|
+
assert_nothing_raised() {
|
3511
|
+
assert_equal "File: bbu.xls
|
3473
3512
|
Number of sheets: 3
|
3474
3513
|
Sheets: 2007_12, Tabelle2, Tabelle3
|
3475
3514
|
Sheet 1:
|
@@ -3481,13 +3520,14 @@ Sheet 2:
|
|
3481
3520
|
- empty -
|
3482
3521
|
Sheet 3:
|
3483
3522
|
- empty -", oo.info
|
3484
|
-
|
3523
|
+
}
|
3485
3524
|
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3525
|
+
oo.default_sheet = oo.sheets[1] # empty sheet
|
3526
|
+
assert_nil oo.first_row
|
3527
|
+
assert_nil oo.last_row
|
3528
|
+
assert_nil oo.first_column
|
3529
|
+
assert_nil oo.last_column
|
3530
|
+
end
|
3491
3531
|
end
|
3492
3532
|
|
3493
3533
|
def test_bug_bbu_excelx
|
@@ -3579,10 +3619,10 @@ Sheet 3:
|
|
3579
3619
|
assert_in_delta 0.50918981481481485, oo.excelx_value('b', 1), 0.000001
|
3580
3620
|
assert_equal :time, oo.celltype('B',1)
|
3581
3621
|
assert_equal 12*3600+13*60+14, oo.cell('B',1) # 12:13:14 (secs since midnight)
|
3582
|
-
|
3622
|
+
|
3583
3623
|
assert_equal :time, oo.celltype('C',1)
|
3584
3624
|
assert_equal 15*3600+16*60, oo.cell('C',1) # 15:16 (secs since midnight)
|
3585
|
-
|
3625
|
+
|
3586
3626
|
assert_equal :time, oo.celltype('D',1)
|
3587
3627
|
assert_equal 23*3600, oo.cell('D',1) # 23:00 (secs since midnight)
|
3588
3628
|
end
|
@@ -3649,7 +3689,7 @@ Sheet 3:
|
|
3649
3689
|
assert_equal "", `diff test/time-test.csv /tmp/time-test.csv`
|
3650
3690
|
end # GOOGLE
|
3651
3691
|
end
|
3652
|
-
|
3692
|
+
|
3653
3693
|
def test_date_time_yaml_openoffice
|
3654
3694
|
if OPENOFFICE
|
3655
3695
|
expected =
|
@@ -3657,7 +3697,7 @@ Sheet 3:
|
|
3657
3697
|
oo = Openoffice.new(File.join("test","time-test.ods"))
|
3658
3698
|
oo.default_sheet = oo.sheets.first
|
3659
3699
|
assert_equal expected, oo.to_yaml
|
3660
|
-
end
|
3700
|
+
end
|
3661
3701
|
end
|
3662
3702
|
|
3663
3703
|
def test_date_time_yaml_excel
|
@@ -3667,7 +3707,7 @@ Sheet 3:
|
|
3667
3707
|
oo = Excel.new(File.join("test","time-test.xls"))
|
3668
3708
|
oo.default_sheet = oo.sheets.first
|
3669
3709
|
assert_equal expected, oo.to_yaml
|
3670
|
-
end
|
3710
|
+
end
|
3671
3711
|
end
|
3672
3712
|
|
3673
3713
|
def test_date_time_yaml_excelx
|
@@ -3677,7 +3717,7 @@ Sheet 3:
|
|
3677
3717
|
oo = Excelx.new(File.join("test","time-test.xlsx"))
|
3678
3718
|
oo.default_sheet = oo.sheets.first
|
3679
3719
|
assert_equal expected, oo.to_yaml
|
3680
|
-
end
|
3720
|
+
end
|
3681
3721
|
end
|
3682
3722
|
|
3683
3723
|
def test_date_time_yaml_google
|
@@ -3687,7 +3727,7 @@ Sheet 3:
|
|
3687
3727
|
oo = Google.new(key_of("time-test"))
|
3688
3728
|
oo.default_sheet = oo.sheets.first
|
3689
3729
|
assert_equal expected, oo.to_yaml
|
3690
|
-
end
|
3730
|
+
end
|
3691
3731
|
end
|
3692
3732
|
|
3693
3733
|
def test_no_remaining_tmp_files_openoffice
|
@@ -3701,9 +3741,9 @@ Sheet 3:
|
|
3701
3741
|
}
|
3702
3742
|
a=Dir.glob("oo_*")
|
3703
3743
|
assert_equal [], a
|
3704
|
-
end
|
3744
|
+
end
|
3705
3745
|
end
|
3706
|
-
|
3746
|
+
|
3707
3747
|
def test_no_remaining_tmp_files_excel
|
3708
3748
|
if EXCEL
|
3709
3749
|
assert_raise(OLE::UnknownFormatError) {
|
@@ -3714,7 +3754,7 @@ Sheet 3:
|
|
3714
3754
|
:ignore)
|
3715
3755
|
}
|
3716
3756
|
a=Dir.glob("oo_*")
|
3717
|
-
assert_equal [], a
|
3757
|
+
assert_equal [], a
|
3718
3758
|
end
|
3719
3759
|
end
|
3720
3760
|
|
@@ -3727,23 +3767,23 @@ Sheet 3:
|
|
3727
3767
|
oo = Excelx.new(File.join("test","no_spreadsheet_file.txt"),
|
3728
3768
|
false,
|
3729
3769
|
:ignore)
|
3730
|
-
|
3770
|
+
|
3731
3771
|
}
|
3732
3772
|
a=Dir.glob("oo_*")
|
3733
|
-
assert_equal [], a
|
3773
|
+
assert_equal [], a
|
3734
3774
|
end
|
3735
3775
|
end
|
3736
|
-
|
3776
|
+
|
3737
3777
|
def test_no_remaining_tmp_files_google
|
3738
3778
|
if GOOGLE
|
3739
3779
|
assert_nothing_raised() {
|
3740
3780
|
oo = Google.new(key_of("no_spreadsheet_file.txt"))
|
3741
3781
|
}
|
3742
3782
|
a=Dir.glob("oo_*")
|
3743
|
-
assert_equal [], a
|
3783
|
+
assert_equal [], a
|
3744
3784
|
end
|
3745
3785
|
end
|
3746
|
-
|
3786
|
+
|
3747
3787
|
# Erstellt eine Liste aller Zellen im Spreadsheet. Dies ist nötig, weil ein einfacher
|
3748
3788
|
# Textvergleich des XML-Outputs nicht funktioniert, da xml-builder die Attribute
|
3749
3789
|
# nicht immer in der gleichen Reihenfolge erzeugt.
|
@@ -3762,7 +3802,7 @@ Sheet 3:
|
|
3762
3802
|
end
|
3763
3803
|
all
|
3764
3804
|
end
|
3765
|
-
|
3805
|
+
|
3766
3806
|
def do_test_xml(oo)
|
3767
3807
|
assert_nothing_raised {oo.to_xml}
|
3768
3808
|
sheetname = oo.sheets.first
|
@@ -3789,7 +3829,7 @@ Sheet 3:
|
|
3789
3829
|
sheetname = oo.sheets[oo.sheets.index(sheetname)+1]
|
3790
3830
|
}
|
3791
3831
|
end
|
3792
|
-
|
3832
|
+
|
3793
3833
|
def test_to_xml_openoffice
|
3794
3834
|
if OPENOFFICE
|
3795
3835
|
oo = Openoffice.new(File.join('test','numbers1.ods'))
|
@@ -3828,41 +3868,47 @@ Sheet 3:
|
|
3828
3868
|
end
|
3829
3869
|
|
3830
3870
|
def test_bug_row_column_fixnum_float
|
3831
|
-
|
3832
|
-
|
3833
|
-
|
3834
|
-
|
3835
|
-
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
3871
|
+
after Date.new(2008,9,15) do
|
3872
|
+
if EXCEL
|
3873
|
+
ex = Excel.new(File.join('test','bug-row-column-fixnum-float.xls'))
|
3874
|
+
ex.default_sheet = ex.sheets.first
|
3875
|
+
assert_equal 42.5, ex.cell('b',2)
|
3876
|
+
assert_equal 43 , ex.cell('c',2)
|
3877
|
+
assert_equal ['hij',42.5, 43], ex.row(2)
|
3878
|
+
assert_equal ['def',42.5, 'nop'], ex.column(2)
|
3879
|
+
end
|
3880
|
+
end
|
3881
|
+
|
3882
|
+
end
|
3883
|
+
|
3840
3884
|
def test_bug_c2
|
3841
|
-
|
3842
|
-
|
3843
|
-
|
3844
|
-
'
|
3845
|
-
|
3846
|
-
|
3847
|
-
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3857
|
-
|
3885
|
+
if EXCEL
|
3886
|
+
after Date.new(2008,12,25) do
|
3887
|
+
local_only do
|
3888
|
+
expected = ['Supermodel X','T6','Shaun White','Jeremy','Custom',
|
3889
|
+
'Warhol','Twin','Malolo','Supermodel','Air','Elite',
|
3890
|
+
'King','Dominant','Dominant Slick','Blunt','Clash',
|
3891
|
+
'Bullet','Tadashi Fuse','Jussi','Royale','S-Series',
|
3892
|
+
'Fish','Love','Feelgood ES','Feelgood','GTwin','Troop',
|
3893
|
+
'Lux','Stigma','Feather','Stria','Alpha','Feelgood ICS']
|
3894
|
+
result = []
|
3895
|
+
@e = Excel.new(File.join('test',"problem.xls"))
|
3896
|
+
@e.sheets[2..@e.sheets.length].each do |s|
|
3897
|
+
#(13..13).each do |s|
|
3898
|
+
@e.default_sheet = s
|
3899
|
+
name = @e.cell(2,'C')
|
3900
|
+
result << name
|
3901
|
+
#puts "#{name} (sheet: #{s})"
|
3902
|
+
#assert_equal "whatever (sheet: 13)", "#{name} (sheet: #{s})"
|
3903
|
+
end
|
3904
|
+
assert_equal expected, result
|
3858
3905
|
end
|
3859
|
-
assert_equal expected, result
|
3860
3906
|
end
|
3861
3907
|
end
|
3862
3908
|
end
|
3863
|
-
|
3909
|
+
|
3864
3910
|
def test_bug_c2_parseexcel
|
3865
|
-
after Date.new(2008,
|
3911
|
+
after Date.new(2008,11,30) do
|
3866
3912
|
local_only do
|
3867
3913
|
#-- this is OK
|
3868
3914
|
@workbook = Spreadsheet::ParseExcel.parse(File.join('test',"problem.xls"))
|
@@ -3871,7 +3917,7 @@ Sheet 3:
|
|
3871
3917
|
line = 1
|
3872
3918
|
row = 2
|
3873
3919
|
col = 3
|
3874
|
-
worksheet.each(skip) { |row_par|
|
3920
|
+
worksheet.each(skip) { |row_par|
|
3875
3921
|
if line == row
|
3876
3922
|
if row_par == nil
|
3877
3923
|
raise "nil"
|
@@ -3889,7 +3935,7 @@ Sheet 3:
|
|
3889
3935
|
line = 1
|
3890
3936
|
row = 2
|
3891
3937
|
col = 3
|
3892
|
-
worksheet.each(skip) { |row_par|
|
3938
|
+
worksheet.each(skip) { |row_par|
|
3893
3939
|
if line == row
|
3894
3940
|
if row_par == nil
|
3895
3941
|
raise "nil"
|
@@ -3903,63 +3949,67 @@ Sheet 3:
|
|
3903
3949
|
end
|
3904
3950
|
end
|
3905
3951
|
end
|
3906
|
-
|
3952
|
+
|
3907
3953
|
def test_bug_c2_excelx
|
3908
|
-
|
3909
|
-
|
3910
|
-
'
|
3911
|
-
|
3912
|
-
|
3913
|
-
|
3914
|
-
|
3915
|
-
|
3916
|
-
|
3917
|
-
|
3918
|
-
@e.
|
3919
|
-
|
3920
|
-
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3925
|
-
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3932
|
-
|
3933
|
-
|
3934
|
-
|
3935
|
-
|
3954
|
+
after Date.new(2008,9,15) do
|
3955
|
+
local_only do
|
3956
|
+
expected = ['Supermodel X','T6','Shaun White','Jeremy','Custom',
|
3957
|
+
'Warhol','Twin','Malolo','Supermodel','Air','Elite',
|
3958
|
+
'King','Dominant','Dominant Slick','Blunt','Clash',
|
3959
|
+
'Bullet','Tadashi Fuse','Jussi','Royale','S-Series',
|
3960
|
+
'Fish','Love','Feelgood ES','Feelgood','GTwin','Troop',
|
3961
|
+
'Lux','Stigma','Feather','Stria','Alpha','Feelgood ICS']
|
3962
|
+
result = []
|
3963
|
+
@e = Excelx.new(File.join('test',"problem.xlsx"))
|
3964
|
+
@e.sheets[2..@e.sheets.length].each do |s|
|
3965
|
+
@e.default_sheet = s
|
3966
|
+
# assert_equal "A.",@e.cell('a',13)
|
3967
|
+
name = @e.cell(2,'C')
|
3968
|
+
result << name
|
3969
|
+
#puts "#{name} (sheet: #{s})"
|
3970
|
+
#assert_equal :string, @e.celltype('c',2)
|
3971
|
+
#assert_equal "Vapor (sheet: Vapor)", "#{name} (sheet: #{@e.sheets.first})"
|
3972
|
+
assert @e.cell(2,'c')
|
3973
|
+
end
|
3974
|
+
assert_equal expected, result
|
3975
|
+
|
3976
|
+
@e = Excelx.new(File.join('test',"problem.xlsx"))
|
3977
|
+
#@e.sheets[2..@e.sheets.length].each do |s|
|
3978
|
+
(13..13).each do |s|
|
3979
|
+
@e.default_sheet = s
|
3980
|
+
name = @e.cell(2,'C')
|
3981
|
+
#puts "#{name} (sheet: #{s})"
|
3982
|
+
assert_equal "Elite (sheet: 13)", "#{name} (sheet: #{s})"
|
3983
|
+
end
|
3936
3984
|
end
|
3937
3985
|
end
|
3938
3986
|
end
|
3939
3987
|
|
3940
3988
|
def test_compare_csv_excelx_excel
|
3941
|
-
|
3942
|
-
|
3943
|
-
|
3944
|
-
|
3945
|
-
|
3946
|
-
|
3947
|
-
s1.
|
3948
|
-
|
3949
|
-
|
3950
|
-
|
3951
|
-
|
3952
|
-
|
3953
|
-
|
3954
|
-
|
3955
|
-
|
3956
|
-
|
3989
|
+
if EXCELX
|
3990
|
+
after Date.new(2008,11,30) do
|
3991
|
+
# parseexcel bug
|
3992
|
+
local_only do
|
3993
|
+
s1 = Excel.new(File.join("test","problem.xls"))
|
3994
|
+
s2 = Excelx.new(File.join("test","problem.xlsx"))
|
3995
|
+
s1.sheets.each {|sh| #TODO:
|
3996
|
+
s1.default_sheet = sh
|
3997
|
+
s2.default_sheet = sh
|
3998
|
+
File.delete_if_exist("/tmp/problem.csv")
|
3999
|
+
File.delete_if_exist("/tmp/problemx.csv")
|
4000
|
+
assert s1.to_csv("/tmp/problem.csv")
|
4001
|
+
assert s2.to_csv("/tmp/problemx.csv")
|
4002
|
+
assert File.exists?("/tmp/problem.csv")
|
4003
|
+
assert File.exists?("/tmp/problemx.csv")
|
4004
|
+
assert_equal "", `diff /tmp/problem.csv /tmp/problemx.csv`, "Unterschied in Sheet #{sh} #{s1.sheets.index(sh)}"
|
4005
|
+
}
|
4006
|
+
end
|
3957
4007
|
end
|
3958
4008
|
end
|
3959
4009
|
end
|
3960
|
-
|
4010
|
+
|
3961
4011
|
def test_problemx_csv_imported
|
3962
|
-
after Date.new(2008,
|
4012
|
+
after Date.new(2008,11,26) do
|
3963
4013
|
if EXCEL
|
3964
4014
|
local_only do
|
3965
4015
|
# wieder eingelesene CSV-Datei aus obigem Test
|
@@ -4035,35 +4085,35 @@ Sheet 3:
|
|
4035
4085
|
|
4036
4086
|
def test_file_warning_warning
|
4037
4087
|
if OPENOFFICE
|
4038
|
-
assert_nothing_raised(TypeError) {
|
4039
|
-
assert_raises(Zip::ZipError) {
|
4040
|
-
oo = Openoffice.new(File.join("test","numbers1.xls"),false, :warning)
|
4088
|
+
assert_nothing_raised(TypeError) {
|
4089
|
+
assert_raises(Zip::ZipError) {
|
4090
|
+
oo = Openoffice.new(File.join("test","numbers1.xls"),false, :warning)
|
4041
4091
|
}
|
4042
4092
|
}
|
4043
|
-
assert_nothing_raised(TypeError) {
|
4093
|
+
assert_nothing_raised(TypeError) {
|
4044
4094
|
assert_raises(Errno::ENOENT) {
|
4045
|
-
oo = Openoffice.new(File.join("test","numbers1.xlsx"),false, :warning)
|
4095
|
+
oo = Openoffice.new(File.join("test","numbers1.xlsx"),false, :warning)
|
4046
4096
|
}
|
4047
4097
|
}
|
4048
4098
|
assert_equal [], Dir.glob("oo_*")
|
4049
4099
|
end
|
4050
4100
|
if EXCEL
|
4051
|
-
assert_nothing_raised(TypeError) {
|
4101
|
+
assert_nothing_raised(TypeError) {
|
4052
4102
|
assert_raises(OLE::UnknownFormatError) {
|
4053
4103
|
oo = Excel.new(File.join("test","numbers1.ods"),false, :warning) }
|
4054
4104
|
}
|
4055
|
-
assert_nothing_raised(TypeError) {
|
4105
|
+
assert_nothing_raised(TypeError) {
|
4056
4106
|
assert_raises(OLE::UnknownFormatError) {
|
4057
4107
|
oo = Excel.new(File.join("test","numbers1.xlsx"),false, :warning) }
|
4058
4108
|
}
|
4059
4109
|
assert_equal [], Dir.glob("oo_*")
|
4060
4110
|
end
|
4061
4111
|
if EXCELX
|
4062
|
-
assert_nothing_raised(TypeError) {
|
4112
|
+
assert_nothing_raised(TypeError) {
|
4063
4113
|
assert_raises(Errno::ENOENT) {
|
4064
4114
|
oo = Excelx.new(File.join("test","numbers1.ods"),false, :warning) }
|
4065
4115
|
}
|
4066
|
-
assert_nothing_raised(TypeError) {
|
4116
|
+
assert_nothing_raised(TypeError) {
|
4067
4117
|
assert_raises(Zip::ZipError) {
|
4068
4118
|
oo = Excelx.new(File.join("test","numbers1.xls"),false, :warning) }
|
4069
4119
|
}
|
@@ -4073,34 +4123,34 @@ Sheet 3:
|
|
4073
4123
|
|
4074
4124
|
def test_file_warning_ignore
|
4075
4125
|
if OPENOFFICE
|
4076
|
-
assert_nothing_raised(TypeError) {
|
4126
|
+
assert_nothing_raised(TypeError) {
|
4077
4127
|
assert_raises(Zip::ZipError) {
|
4078
4128
|
oo = Openoffice.new(File.join("test","numbers1.xls"),false, :ignore) }
|
4079
4129
|
}
|
4080
|
-
assert_nothing_raised(TypeError) {
|
4130
|
+
assert_nothing_raised(TypeError) {
|
4081
4131
|
assert_raises(Errno::ENOENT) {
|
4082
4132
|
oo = Openoffice.new(File.join("test","numbers1.xlsx"),false, :ignore) }
|
4083
4133
|
}
|
4084
4134
|
assert_equal [], Dir.glob("oo_*")
|
4085
4135
|
end
|
4086
4136
|
if EXCEL
|
4087
|
-
assert_nothing_raised(TypeError) {
|
4137
|
+
assert_nothing_raised(TypeError) {
|
4088
4138
|
assert_raises(OLE::UnknownFormatError) {
|
4089
4139
|
oo = Excel.new(File.join("test","numbers1.ods"),false, :ignore) }
|
4090
4140
|
}
|
4091
|
-
assert_nothing_raised(TypeError) {
|
4141
|
+
assert_nothing_raised(TypeError) {
|
4092
4142
|
assert_raises(OLE::UnknownFormatError) {oo = Excel.new(File.join("test","numbers1.xlsx"),false, :ignore) }}
|
4093
4143
|
assert_equal [], Dir.glob("oo_*")
|
4094
4144
|
end
|
4095
4145
|
if EXCELX
|
4096
|
-
assert_nothing_raised(TypeError) {
|
4146
|
+
assert_nothing_raised(TypeError) {
|
4097
4147
|
assert_raises(Errno::ENOENT) {
|
4098
|
-
oo = Excelx.new(File.join("test","numbers1.ods"),false, :ignore)
|
4148
|
+
oo = Excelx.new(File.join("test","numbers1.ods"),false, :ignore)
|
4099
4149
|
}
|
4100
4150
|
}
|
4101
|
-
assert_nothing_raised(TypeError) {
|
4151
|
+
assert_nothing_raised(TypeError) {
|
4102
4152
|
assert_raises(Zip::ZipError) {
|
4103
|
-
oo = Excelx.new(File.join("test","numbers1.xls"),false, :ignore)
|
4153
|
+
oo = Excelx.new(File.join("test","numbers1.xls"),false, :ignore)
|
4104
4154
|
}
|
4105
4155
|
}
|
4106
4156
|
assert_equal [], Dir.glob("oo_*")
|
@@ -4108,20 +4158,22 @@ Sheet 3:
|
|
4108
4158
|
end
|
4109
4159
|
|
4110
4160
|
def test_open_from_uri
|
4111
|
-
if
|
4112
|
-
|
4113
|
-
|
4114
|
-
|
4115
|
-
|
4116
|
-
|
4117
|
-
|
4118
|
-
|
4119
|
-
|
4120
|
-
|
4121
|
-
|
4122
|
-
|
4123
|
-
|
4124
|
-
|
4161
|
+
if ONLINE
|
4162
|
+
if OPENOFFICE
|
4163
|
+
assert_raises(RuntimeError) {
|
4164
|
+
oo = Openoffice.new("http://gibbsnichtdomainxxxxx.com/file.ods")
|
4165
|
+
}
|
4166
|
+
end
|
4167
|
+
if EXCEL
|
4168
|
+
assert_raises(RuntimeError) {
|
4169
|
+
oo = Excel.new("http://gibbsnichtdomainxxxxx.com/file.xls")
|
4170
|
+
}
|
4171
|
+
end
|
4172
|
+
if EXCELX
|
4173
|
+
assert_raises(RuntimeError) {
|
4174
|
+
oo = Excelx.new("http://gibbsnichtdomainxxxxx.com/file.xlsx")
|
4175
|
+
}
|
4176
|
+
end
|
4125
4177
|
end
|
4126
4178
|
end
|
4127
4179
|
|
@@ -4130,7 +4182,7 @@ Sheet 3:
|
|
4130
4182
|
oo = Excel.new(File.join("test","time-test.xls"))
|
4131
4183
|
oo.default_sheet = oo.sheets.first
|
4132
4184
|
assert_equal 2, oo.last_row
|
4133
|
-
end
|
4185
|
+
end
|
4134
4186
|
end
|
4135
4187
|
|
4136
4188
|
def test_bug_to_xml_with_empty_sheets_openoffice
|
@@ -4267,27 +4319,29 @@ Sheet 3:
|
|
4267
4319
|
assert_equal 'C4-B4-D4', oo.formula('e',4)
|
4268
4320
|
assert_equal :string, oo.celltype('f',4)
|
4269
4321
|
assert_equal "Task 1", oo.cell('f',4)
|
4270
|
-
end
|
4322
|
+
end
|
4271
4323
|
end
|
4272
4324
|
end
|
4273
4325
|
|
4274
4326
|
def test_possible_bug_snowboard_borders
|
4275
|
-
|
4276
|
-
|
4277
|
-
|
4278
|
-
|
4279
|
-
|
4280
|
-
|
4281
|
-
|
4282
|
-
|
4283
|
-
|
4284
|
-
|
4285
|
-
|
4286
|
-
|
4287
|
-
|
4288
|
-
|
4289
|
-
|
4290
|
-
|
4327
|
+
after Date.new(2008,12,15) do
|
4328
|
+
local_only do
|
4329
|
+
if EXCEL
|
4330
|
+
ex = Excel.new(File.join('test','problem.xls'))
|
4331
|
+
ex.default_sheet = ex.sheets.first
|
4332
|
+
assert_equal 2, ex.first_row
|
4333
|
+
assert_equal 30, ex.last_row
|
4334
|
+
assert_equal 'A', ex.first_column_as_letter
|
4335
|
+
assert_equal 'J', ex.last_column_as_letter
|
4336
|
+
end
|
4337
|
+
if EXCELX
|
4338
|
+
ex = Excelx.new(File.join('test','problem.xlsx'))
|
4339
|
+
ex.default_sheet = ex.sheets.first
|
4340
|
+
assert_equal 2, ex.first_row
|
4341
|
+
assert_equal 30, ex.last_row
|
4342
|
+
assert_equal 'A', ex.first_column_as_letter
|
4343
|
+
assert_equal 'J', ex.last_column_as_letter
|
4344
|
+
end
|
4291
4345
|
end
|
4292
4346
|
end
|
4293
4347
|
end
|
@@ -4306,10 +4360,10 @@ Sheet 3:
|
|
4306
4360
|
assert_equal "164W", ss.cell(13,'n'), ss.class
|
4307
4361
|
assert_equal "168W", ss.cell(13,'o'), ss.class
|
4308
4362
|
end
|
4309
|
-
|
4363
|
+
|
4310
4364
|
def test_possible_bug_snowboard_cells
|
4311
4365
|
local_only do
|
4312
|
-
after Date.new(2008,
|
4366
|
+
after Date.new(2008,12,26) do
|
4313
4367
|
# warten auf Bugfix in parseexcel
|
4314
4368
|
if EXCEL
|
4315
4369
|
ex = Excel.new(File.join('test','problem.xls'))
|
@@ -4324,7 +4378,480 @@ Sheet 3:
|
|
4324
4378
|
end
|
4325
4379
|
end
|
4326
4380
|
end
|
4381
|
+
|
4382
|
+
if EXCELX
|
4383
|
+
def test_possible_bug_2008_09_13
|
4384
|
+
local_only do
|
4385
|
+
# war nur in der 1.0.0 Release ein Fehler und sollte mit aktueller
|
4386
|
+
# Release nicht mehr auftreten.
|
4387
|
+
=begin
|
4388
|
+
−
|
4389
|
+
<sst count="46" uniqueCount="39">
|
4390
|
+
−
|
4391
|
+
0<si>
|
4392
|
+
<t>Bond</t>
|
4393
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4394
|
+
</si>
|
4395
|
+
−
|
4396
|
+
1<si>
|
4397
|
+
<t>James</t>
|
4398
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4399
|
+
</si>
|
4400
|
+
−
|
4401
|
+
2<si>
|
4402
|
+
<t>8659</t>
|
4403
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4404
|
+
</si>
|
4405
|
+
−
|
4406
|
+
3<si>
|
4407
|
+
<t>12B</t>
|
4408
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4409
|
+
</si>
|
4410
|
+
−
|
4411
|
+
4<si>
|
4412
|
+
<t>087692</t>
|
4413
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4414
|
+
</si>
|
4415
|
+
−
|
4416
|
+
5<si>
|
4417
|
+
<t>Rowe</t>
|
4418
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4419
|
+
</si>
|
4420
|
+
−
|
4421
|
+
6<si>
|
4422
|
+
<t>Karl</t>
|
4423
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4424
|
+
</si>
|
4425
|
+
−
|
4426
|
+
7<si>
|
4427
|
+
<t>9128</t>
|
4428
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4429
|
+
</si>
|
4430
|
+
−
|
4431
|
+
8<si>
|
4432
|
+
<t>79A</t>
|
4433
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4434
|
+
</si>
|
4435
|
+
−
|
4436
|
+
9<si>
|
4437
|
+
<t>Benson</t>
|
4438
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4439
|
+
</si>
|
4440
|
+
−
|
4441
|
+
10<si>
|
4442
|
+
<t>Cedric</t>
|
4443
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4444
|
+
</si>
|
4445
|
+
−
|
4446
|
+
11<si>
|
4447
|
+
<t>Greenstreet</t>
|
4448
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4449
|
+
</si>
|
4450
|
+
−
|
4451
|
+
12<si>
|
4452
|
+
<t>Jenny</t>
|
4453
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4454
|
+
</si>
|
4455
|
+
−
|
4456
|
+
13<si>
|
4457
|
+
<t>Smith</t>
|
4458
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4459
|
+
</si>
|
4460
|
+
−
|
4461
|
+
14<si>
|
4462
|
+
<t>Greame</t>
|
4463
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4464
|
+
</si>
|
4465
|
+
−
|
4466
|
+
15<si>
|
4467
|
+
<t>Lucas</t>
|
4468
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4469
|
+
</si>
|
4470
|
+
−
|
4471
|
+
16<si>
|
4472
|
+
<t>Ward</t>
|
4473
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4474
|
+
</si>
|
4475
|
+
−
|
4476
|
+
17<si>
|
4477
|
+
<t>Lee</t>
|
4478
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4479
|
+
</si>
|
4480
|
+
−
|
4481
|
+
18<si>
|
4482
|
+
<t>Bret</t>
|
4483
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4484
|
+
</si>
|
4485
|
+
−
|
4486
|
+
19<si>
|
4487
|
+
<t>Warne</t>
|
4488
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4489
|
+
</si>
|
4490
|
+
−
|
4491
|
+
20<si>
|
4492
|
+
<t>Shane</t>
|
4493
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4494
|
+
</si>
|
4495
|
+
−
|
4496
|
+
21<si>
|
4497
|
+
<t>782</t>
|
4498
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4499
|
+
</si>
|
4500
|
+
−
|
4501
|
+
22<si>
|
4502
|
+
<t>876</t>
|
4503
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4504
|
+
</si>
|
4505
|
+
−
|
4506
|
+
23<si>
|
4507
|
+
<t>9901</t>
|
4508
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4509
|
+
</si>
|
4510
|
+
−
|
4511
|
+
24<si>
|
4512
|
+
<t>1235</t>
|
4513
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4514
|
+
</si>
|
4515
|
+
−
|
4516
|
+
25<si>
|
4517
|
+
<t>16547</t>
|
4518
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4519
|
+
</si>
|
4520
|
+
−
|
4521
|
+
26<si>
|
4522
|
+
<t>7789</t>
|
4523
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4524
|
+
</si>
|
4525
|
+
−
|
4526
|
+
27<si>
|
4527
|
+
<t>89</t>
|
4528
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4529
|
+
</si>
|
4530
|
+
−
|
4531
|
+
28<si>
|
4532
|
+
<t>12A</t>
|
4533
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4534
|
+
</si>
|
4535
|
+
−
|
4536
|
+
29<si>
|
4537
|
+
<t>19A</t>
|
4538
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4539
|
+
</si>
|
4540
|
+
−
|
4541
|
+
30<si>
|
4542
|
+
<t>256</t>
|
4543
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4544
|
+
</si>
|
4545
|
+
−
|
4546
|
+
31<si>
|
4547
|
+
<t>129B</t>
|
4548
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4549
|
+
</si>
|
4550
|
+
−
|
4551
|
+
32<si>
|
4552
|
+
<t>11</t>
|
4553
|
+
<phoneticPr fontId="1" type="noConversion"/>
|
4554
|
+
</si>
|
4555
|
+
−
|
4556
|
+
33<si>
|
4557
|
+
<t>Last Name</t>
|
4558
|
+
</si>
|
4559
|
+
−
|
4560
|
+
34<si>
|
4561
|
+
<t>First Name</t>
|
4562
|
+
</si>
|
4563
|
+
−
|
4564
|
+
35 <si>
|
4565
|
+
<t>Middle Name</t>
|
4566
|
+
</si>
|
4567
|
+
−
|
4568
|
+
36<si>
|
4569
|
+
<t>Resident ID</t>
|
4570
|
+
</si>
|
4571
|
+
−
|
4572
|
+
37<si>
|
4573
|
+
<t>Room Number</t>
|
4574
|
+
</si>
|
4575
|
+
−
|
4576
|
+
38<si>
|
4577
|
+
<t>Provider ID #</t>
|
4578
|
+
</si>
|
4579
|
+
</sst>
|
4580
|
+
Hello Thomas,
|
4581
|
+
How are you doing ? I am running into this strange issue with roo plugin (1.0.0). The attached
|
4582
|
+
spreadsheet has all the cells formatted as "text", when I view in the Excel spreadsheet. But when it
|
4583
|
+
get's into roo plugin (set_cell_values method - line 299), the values for the cells 1,1, 1,2, 1,3...1,6
|
4584
|
+
show as 'date' instead of 'string'.
|
4585
|
+
Because of this my parser is failing to get the proper values from the spreadsheet. Any ideas why
|
4586
|
+
the formatting is getting set to the wrong value ?
|
4587
|
+
Even stranger is if I save this file as ".XLS" and parse it the cells parse out fine as they are treated as
|
4588
|
+
'string' instead of 'date'.
|
4589
|
+
This attached file is the newer format of Microsoft Excel (.xlsx).
|
4590
|
+
|
4591
|
+
=end
|
4592
|
+
xx = Excelx.new(File.join('test','sample_file_2008-09-13.xlsx'))
|
4593
|
+
assert_equal 1, xx.sheets.size
|
4594
|
+
|
4595
|
+
assert_equal 1, xx.first_row
|
4596
|
+
assert_equal 9, xx.last_row # 9 ist richtig. Es sind zwar 44 Zeilen definiert, aber der Rest hat keinen Inhalt
|
4597
|
+
assert_equal 1, xx.first_column
|
4598
|
+
assert_equal 6, xx.last_column
|
4599
|
+
assert_equal 'A', xx.first_column_as_letter
|
4600
|
+
assert_equal 'F', xx.last_column_as_letter
|
4601
|
+
|
4602
|
+
assert_nothing_raised() {
|
4603
|
+
puts xx.info
|
4604
|
+
}
|
4605
|
+
p xx.cell(1,1)
|
4606
|
+
p xx.cell(1,2)
|
4607
|
+
p xx.cell(1,3)
|
4608
|
+
p xx.cell(1,4)
|
4609
|
+
p xx.cell(1,5)
|
4610
|
+
p xx.cell(1,6)
|
4611
|
+
xx.default_sheet = xx.sheets.first
|
4612
|
+
|
4613
|
+
assert_equal 'Last Name', xx.cell('A',1)
|
4614
|
+
|
4615
|
+
1.upto(6) do |col|
|
4616
|
+
assert_equal :string, xx.celltype(1,col)
|
4617
|
+
end
|
4618
|
+
#for col in (1..6)
|
4619
|
+
# assert_equal "1234", xx.cell(1,col)
|
4620
|
+
#end
|
4621
|
+
end
|
4622
|
+
end
|
4623
|
+
end
|
4624
|
+
|
4625
|
+
def test_datetime_openoffice
|
4626
|
+
if OPENOFFICE
|
4627
|
+
oo = Openoffice.new(File.join("test","datetime.ods"))
|
4628
|
+
oo.default_sheet = oo.sheets.first
|
4629
|
+
val = oo.cell('c',3)
|
4630
|
+
assert_kind_of DateTime, val
|
4631
|
+
assert_equal :datetime, oo.celltype('c',3)
|
4632
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), val
|
4633
|
+
val = oo.cell('a',1)
|
4634
|
+
assert_kind_of Date, val
|
4635
|
+
assert_equal :date, oo.celltype('a',1)
|
4636
|
+
assert_equal Date.new(1961,11,21), val
|
4637
|
+
|
4638
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',1)
|
4639
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',3)
|
4640
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',3)
|
4641
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',3)
|
4642
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',4)
|
4643
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',4)
|
4644
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',4)
|
4645
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',5)
|
4646
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',5)
|
4647
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',5)
|
4648
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',6)
|
4649
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',6)
|
4650
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',6)
|
4651
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',7)
|
4652
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',7)
|
4653
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',7)
|
4654
|
+
end
|
4655
|
+
end
|
4656
|
+
|
4657
|
+
def test_datetime_excel
|
4658
|
+
if EXCEL
|
4659
|
+
oo = Excel.new(File.join("test","datetime.xls"))
|
4660
|
+
oo.default_sheet = oo.sheets.first
|
4661
|
+
val = oo.cell('c',3)
|
4662
|
+
assert_kind_of DateTime, val
|
4663
|
+
assert_equal :datetime, oo.celltype('c',3)
|
4664
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), val
|
4665
|
+
val = oo.cell('a',1)
|
4666
|
+
assert_kind_of Date, val
|
4667
|
+
assert_equal :date, oo.celltype('a',1)
|
4668
|
+
assert_equal Date.new(1961,11,21), val
|
4669
|
+
|
4670
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',1)
|
4671
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',3)
|
4672
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',3)
|
4673
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',3)
|
4674
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',4)
|
4675
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',4)
|
4676
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',4)
|
4677
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',5)
|
4678
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',5)
|
4679
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',5)
|
4680
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',6)
|
4681
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',6)
|
4682
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',6)
|
4683
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',7)
|
4684
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',7)
|
4685
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',7)
|
4686
|
+
end
|
4687
|
+
end
|
4688
|
+
|
4689
|
+
def test_datetime_excelx
|
4690
|
+
after Date.new(2008,11,15) do
|
4691
|
+
if EXCELX
|
4692
|
+
oo = Excelx.new(File.join("test","datetime.xlsx"))
|
4693
|
+
oo.default_sheet = oo.sheets.first
|
4694
|
+
val = oo.cell('c',3)
|
4695
|
+
assert_kind_of DateTime, val
|
4696
|
+
assert_equal :datetime, oo.celltype('c',3)
|
4697
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), val
|
4698
|
+
val = oo.cell('a',1)
|
4699
|
+
assert_kind_of Date, val
|
4700
|
+
assert_equal :date, oo.celltype('a',1)
|
4701
|
+
assert_equal Date.new(1961,11,21), val
|
4702
|
+
|
4703
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',1)
|
4704
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',3)
|
4705
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',3)
|
4706
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',3)
|
4707
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',4)
|
4708
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',4)
|
4709
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',4)
|
4710
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',5)
|
4711
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',5)
|
4712
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',5)
|
4713
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',6)
|
4714
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',6)
|
4715
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',6)
|
4716
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',7)
|
4717
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',7)
|
4718
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',7)
|
4719
|
+
end
|
4720
|
+
end
|
4721
|
+
end
|
4722
|
+
|
4723
|
+
def test_datetime_google
|
4724
|
+
if GOOGLE
|
4725
|
+
oo = Google.new(File.join("test","googlekey"))
|
4726
|
+
oo.default_sheet = oo.sheets.first
|
4727
|
+
val = oo.cell('c',3)
|
4728
|
+
assert_kind_of DateTime, val
|
4729
|
+
assert_equal :datetime, oo.celltype('c',3)
|
4730
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), val
|
4731
|
+
val = oo.cell('a',1)
|
4732
|
+
assert_kind_of Date, val
|
4733
|
+
assert_equal :date, oo.celltype('a',1)
|
4734
|
+
assert_equal Date.new(1961,11,21), val
|
4735
|
+
|
4736
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',1)
|
4737
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',3)
|
4738
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',3)
|
4739
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',3)
|
4740
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',4)
|
4741
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',4)
|
4742
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',4)
|
4743
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('a',5)
|
4744
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('b',5)
|
4745
|
+
assert_equal DateTime.new(1961,11,21,12,17,18), oo.cell('c',5)
|
4746
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',6)
|
4747
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',6)
|
4748
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',6)
|
4749
|
+
assert_equal Date.new(1961,11,21), oo.cell('a',7)
|
4750
|
+
assert_equal Date.new(1961,11,21), oo.cell('b',7)
|
4751
|
+
assert_equal Date.new(1961,11,21), oo.cell('c',7)
|
4752
|
+
end
|
4753
|
+
end
|
4754
|
+
|
4755
|
+
#-- bei diesen Test bekomme ich seltsamerweise einen Fehler can't allocate
|
4756
|
+
#-- memory innerhalb der zip-Routinen => erstmal deaktiviert
|
4757
|
+
def test_huge_table_timing_10_000_openoffice
|
4758
|
+
after Date.new(2009,1,1) do
|
4759
|
+
if OPENOFFICE
|
4760
|
+
assert_nothing_raised(Timeout::Error) {
|
4761
|
+
Timeout::timeout(3.minutes) do |timeout_length|
|
4762
|
+
oo = Openoffice.new("/home/tp/ruby-test/too-testing/speedtest_10000.ods")
|
4763
|
+
# process every cell
|
4764
|
+
sum = 0
|
4765
|
+
oo.sheets.each {|sheet|
|
4766
|
+
oo.default_sheet = sheet
|
4767
|
+
for row in oo.first_row..oo.last_row do
|
4768
|
+
for col in oo.first_column..oo.last_column do
|
4769
|
+
c = oo.cell(row,col)
|
4770
|
+
sum += c.length if c
|
4771
|
+
end
|
4772
|
+
end
|
4773
|
+
p sum
|
4774
|
+
assert sum > 0
|
4775
|
+
}
|
4776
|
+
end
|
4777
|
+
}
|
4778
|
+
end
|
4779
|
+
end
|
4780
|
+
end
|
4781
|
+
|
4782
|
+
def test_huge_table_timing_10_000_excel
|
4783
|
+
after Date.new(2009,1,1) do
|
4784
|
+
if EXCEL
|
4785
|
+
assert_nothing_raised(Timeout::Error) {
|
4786
|
+
Timeout::timeout(3.minutes) do |timeout_length|
|
4787
|
+
oo = Excel.new("/home/tp/ruby-test/too-testing/speedtest_10000.xls")
|
4788
|
+
# process every cell
|
4789
|
+
sum = 0
|
4790
|
+
oo.sheets.each {|sheet|
|
4791
|
+
oo.default_sheet = sheet
|
4792
|
+
for row in oo.first_row..oo.last_row do
|
4793
|
+
for col in oo.first_column..oo.last_column do
|
4794
|
+
c = oo.cell(row,col)
|
4795
|
+
sum += c.length if c
|
4796
|
+
end
|
4797
|
+
end
|
4798
|
+
p sum
|
4799
|
+
assert sum > 0
|
4800
|
+
}
|
4801
|
+
end
|
4802
|
+
}
|
4803
|
+
end
|
4804
|
+
end
|
4805
|
+
end
|
4327
4806
|
|
4807
|
+
def test_huge_table_timing_10_000_google
|
4808
|
+
after Date.new(2009,1,1) do
|
4809
|
+
if GOOGLE
|
4810
|
+
assert_nothing_raised(Timeout::Error) {
|
4811
|
+
Timeout::timeout(3.minutes) do |timeout_length|
|
4812
|
+
oo = Excel.new(key_of("/home/tp/ruby-test/too-testing/speedtest_10000.xls"))
|
4813
|
+
# process every cell
|
4814
|
+
sum = 0
|
4815
|
+
oo.sheets.each {|sheet|
|
4816
|
+
oo.default_sheet = sheet
|
4817
|
+
for row in oo.first_row..oo.last_row do
|
4818
|
+
for col in oo.first_column..oo.last_column do
|
4819
|
+
c = oo.cell(row,col)
|
4820
|
+
sum += c.length if c
|
4821
|
+
end
|
4822
|
+
end
|
4823
|
+
p sum
|
4824
|
+
assert sum > 0
|
4825
|
+
}
|
4826
|
+
end
|
4827
|
+
}
|
4828
|
+
end
|
4829
|
+
end
|
4830
|
+
end
|
4328
4831
|
|
4832
|
+
def test_huge_table_timing_10_000_excelx
|
4833
|
+
after Date.new(2009,1,1) do
|
4834
|
+
if EXCELX
|
4835
|
+
assert_nothing_raised(Timeout::Error) {
|
4836
|
+
Timeout::timeout(3.minutes) do |timeout_length|
|
4837
|
+
oo = Excelx.new("/home/tp/ruby-test/too-testing/speedtest_10000.xlsx")
|
4838
|
+
# process every cell
|
4839
|
+
sum = 0
|
4840
|
+
oo.sheets.each {|sheet|
|
4841
|
+
oo.default_sheet = sheet
|
4842
|
+
for row in oo.first_row..oo.last_row do
|
4843
|
+
for col in oo.first_column..oo.last_column do
|
4844
|
+
c = oo.cell(row,col)
|
4845
|
+
sum += c.length if c
|
4846
|
+
end
|
4847
|
+
end
|
4848
|
+
p sum
|
4849
|
+
assert sum > 0
|
4850
|
+
}
|
4851
|
+
end
|
4852
|
+
}
|
4853
|
+
end
|
4854
|
+
end
|
4855
|
+
end
|
4329
4856
|
|
4330
4857
|
end # class
|