fast_excel 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +34 -0
- data/.gitignore +2 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +9 -8
- data/Makefile +28 -1
- data/README.md +2 -2
- data/examples/example_filters.rb +2 -2
- data/fast_excel.gemspec +1 -1
- data/lib/fast_excel/binding/workbook.rb +3 -3
- data/lib/fast_excel/binding.rb +5 -8
- data/lib/fast_excel.rb +11 -6
- data/test/validations_test.rb +13 -2
- metadata +4 -7
- data/.travis.yml +0 -51
- data/Gemfile.lock +0 -79
- data/appveyor.yml +0 -25
- data/test/text_width_test.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81f6dc41f599591425a032e95046733c9a27b7b44e5f6d15f71c9040e1452eaf
|
4
|
+
data.tar.gz: 05ce040ed72e6c056311177c5753d6f363d8750515502054648cac440d3cde09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f614c8458db906397a2c27825c302e4a0d7a3f2958ed7053a33c9bd2dcbfd063fd27e5a6a8b1a7b3d230afc23919f359d27e61b785ded07b6cf95de55081d711
|
7
|
+
data.tar.gz: cbc0d5436ddde9052359e069a2d4e706810b9bd9ed28c544eca6e072566d32af9fba8b762cb47c011400d676dc71d7b641902058758f97cab98f44a9baef5ff9
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
strategy:
|
8
|
+
fail-fast: false
|
9
|
+
matrix:
|
10
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
11
|
+
ruby: [2.7, '3.0', 3.1, 3.2]
|
12
|
+
|
13
|
+
runs-on: ${{ matrix.os }}
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
|
21
|
+
- run: bundle config set --local without 'benchmarks'
|
22
|
+
- run: bundle install
|
23
|
+
- run: make
|
24
|
+
- run: make install
|
25
|
+
|
26
|
+
- run: rake test
|
27
|
+
- run: rake examples
|
28
|
+
- run: gem build fast_excel.gemspec
|
29
|
+
|
30
|
+
|
31
|
+
gobills-critical
|
32
|
+
gp-di-critical
|
33
|
+
|
34
|
+
gp-di-alert
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
#### Version 0.4.1 - 13 jan 2023
|
2
|
+
|
3
|
+
* Support ruby 3.2
|
4
|
+
* Improve library loading (Thanks to @sly7-7 and @BrianHawley)
|
5
|
+
* Ensure Time.zone is not nil (Thanks to @ksuh90)
|
6
|
+
* Get utc_offset from current value if possible (Thanks to @KevinSchiffmann)
|
7
|
+
* Validate worksheet name using Libxlsxwriter (Thanks to @datbth)
|
8
|
+
* Fix readme typo (Thanks to @sw4d)
|
9
|
+
|
1
10
|
#### Version 0.4.0 - 14 feb 2021
|
2
11
|
|
3
12
|
* Support ruby 3.0
|
data/Gemfile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
gem 'ffi_gen', require: false
|
3
|
+
gemspec
|
5
4
|
|
6
5
|
gem 'rake'
|
7
6
|
|
@@ -10,9 +9,11 @@ gem 'roo', '2.8.3', git: 'https://github.com/roo-rb/roo.git', tag: 'v2.8.3'
|
|
10
9
|
gem 'minitest'
|
11
10
|
gem 'minitest-reporters'
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
gem '
|
16
|
-
gem '
|
17
|
-
gem '
|
18
|
-
gem '
|
12
|
+
|
13
|
+
group :benchmarks do
|
14
|
+
gem 'axlsx', git: 'https://github.com/randym/axlsx.git'
|
15
|
+
gem 'write_xlsx'
|
16
|
+
gem 'xlsxtream'
|
17
|
+
gem 'benchmark-ips'
|
18
|
+
gem 'process_memory', git: 'https://github.com/paxa/process_memory', platforms: :ruby
|
19
|
+
end
|
data/Makefile
CHANGED
@@ -3,12 +3,39 @@ ifdef V
|
|
3
3
|
Q=
|
4
4
|
endif
|
5
5
|
|
6
|
+
UNAME := $(shell uname)
|
7
|
+
|
8
|
+
LIBXLSXWRITER_SO = libxlsxwriter.so
|
9
|
+
|
10
|
+
ifeq ($(UNAME), Darwin)
|
11
|
+
LIBXLSXWRITER_SO = libxlsxwriter.dylib
|
12
|
+
endif
|
13
|
+
|
14
|
+
# Check for MinGW/MinGW64/Cygwin environments.
|
15
|
+
ifneq (,$(findstring MINGW, $(UNAME)))
|
16
|
+
MING_LIKE = y
|
17
|
+
endif
|
18
|
+
ifneq (,$(findstring MSYS, $(UNAME)))
|
19
|
+
MING_LIKE = y
|
20
|
+
endif
|
21
|
+
ifneq (,$(findstring CYGWIN, $(UNAME)))
|
22
|
+
MING_LIKE = y
|
23
|
+
endif
|
24
|
+
|
25
|
+
ifdef MING_LIKE
|
26
|
+
LIBXLSXWRITER_SO = libxlsxwriter.dll
|
27
|
+
endif
|
28
|
+
|
6
29
|
# with xcode better to use cmake
|
7
30
|
UNAME_S := $(shell uname -s)
|
8
31
|
ifeq ($(UNAME_S),"Darwin")
|
9
32
|
USE_CMAKE := $(shell command -v cmake 2> /dev/null)
|
10
33
|
endif
|
11
34
|
|
35
|
+
ifndef ($(sitearchdir))
|
36
|
+
sitearchdir = './lib'
|
37
|
+
endif
|
38
|
+
|
12
39
|
all :
|
13
40
|
# @echo "Compiling ext/text_width ..."
|
14
41
|
# rake compile
|
@@ -24,4 +51,4 @@ clean :
|
|
24
51
|
$(Q)$(MAKE) clean -C libxlsxwriter
|
25
52
|
|
26
53
|
install :
|
27
|
-
|
54
|
+
$(Q)cp libxlsxwriter/lib/$(LIBXLSXWRITER_SO) $(sitearchdir)
|
data/README.md
CHANGED
@@ -55,7 +55,7 @@ workbook = FastExcel.open # creates tmp file
|
|
55
55
|
send_data(workbook.read_string, filename: "table.xlsx") # read tmp file and delete it
|
56
56
|
```
|
57
57
|
|
58
|
-
Also can use `workbook.
|
58
|
+
Also can use `workbook.remove_tmp_folder` to delete tmp file manually
|
59
59
|
|
60
60
|
|
61
61
|
**Constant memory mode**: saves each row to disk, good for really big files but can not change previous lines that already saved
|
@@ -118,7 +118,7 @@ worksheet.write_url(0, 2, "https://github.com/Paxa/fast_excel", url_format)
|
|
118
118
|
|
119
119
|
### Data Formatting
|
120
120
|
```ruby
|
121
|
-
format =
|
121
|
+
format = workbook.add_format(
|
122
122
|
bold: true,
|
123
123
|
italic: true,
|
124
124
|
font_outline: true,
|
data/examples/example_filters.rb
CHANGED
@@ -12,8 +12,8 @@ workbook.default_format.set(
|
|
12
12
|
|
13
13
|
worksheet = workbook.add_worksheet("Payments Report")
|
14
14
|
|
15
|
-
p worksheet[:filter_on]
|
16
|
-
FastExcel.print_ffi_obj(worksheet)
|
15
|
+
# p worksheet[:filter_on]
|
16
|
+
# FastExcel.print_ffi_obj(worksheet)
|
17
17
|
|
18
18
|
bold = workbook.bold_format
|
19
19
|
worksheet.set_column(0, 0, FastExcel::DEF_COL_WIDTH, bold)
|
data/fast_excel.gemspec
CHANGED
@@ -147,7 +147,7 @@ module Libxlsxwriter
|
|
147
147
|
# @param [String] sheetname
|
148
148
|
# @return [Symbol from _enum_error_]
|
149
149
|
def validate_worksheet_name(sheetname)
|
150
|
-
Libxlsxwriter.
|
150
|
+
Libxlsxwriter.workbook_validate_sheet_name(self, sheetname)
|
151
151
|
end
|
152
152
|
|
153
153
|
# @return [nil]
|
@@ -319,12 +319,12 @@ module Libxlsxwriter
|
|
319
319
|
# @scope class
|
320
320
|
attach_function :workbook_get_worksheet_by_name, :workbook_get_worksheet_by_name, [Workbook, :string], Worksheet
|
321
321
|
|
322
|
-
# @method
|
322
|
+
# @method workbook_validate_sheet_name(workbook, sheetname)
|
323
323
|
# @param [Workbook] workbook
|
324
324
|
# @param [String] sheetname
|
325
325
|
# @return [Symbol from _enum_error_]
|
326
326
|
# @scope class
|
327
|
-
attach_function :
|
327
|
+
attach_function :workbook_validate_sheet_name, :workbook_validate_sheet_name, [Workbook, :string], :error
|
328
328
|
|
329
329
|
# @method workbook_free(workbook)
|
330
330
|
# @param [Workbook] workbook
|
data/lib/fast_excel/binding.rb
CHANGED
@@ -5,15 +5,12 @@ require 'ffi'
|
|
5
5
|
module Libxlsxwriter
|
6
6
|
extend FFI::Library
|
7
7
|
|
8
|
-
LIB_FILENAME =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
else
|
13
|
-
"libxlsxwriter.so"
|
14
|
-
end
|
8
|
+
LIB_FILENAME = "libxlsxwriter.#{FFI::Platform::LIBSUFFIX}".freeze
|
9
|
+
|
10
|
+
libs = [File.expand_path("../../#{LIB_FILENAME}", __FILE__)]
|
11
|
+
libs.unshift(File.join(Gem.loaded_specs['fast_excel'].extension_dir, LIB_FILENAME)) if Gem.loaded_specs['fast_excel']
|
15
12
|
|
16
|
-
ffi_lib
|
13
|
+
ffi_lib(libs)
|
17
14
|
|
18
15
|
def self.attach_function(name, *_)
|
19
16
|
begin; super; rescue FFI::NotFoundError => e
|
data/lib/fast_excel.rb
CHANGED
@@ -91,8 +91,11 @@ module FastExcel
|
|
91
91
|
# https://support.microsoft.com/en-us/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel
|
92
92
|
def self.date_num(time, offset = nil)
|
93
93
|
unless offset
|
94
|
-
# Try use
|
95
|
-
if
|
94
|
+
# Try use value utc_offset
|
95
|
+
if time.respond_to?(:utc_offset)
|
96
|
+
offset = time.utc_offset
|
97
|
+
# Else try use Rails' app timezone
|
98
|
+
elsif Time.respond_to?(:zone) && !Time.zone.nil?
|
96
99
|
offset = Time.zone.utc_offset
|
97
100
|
else
|
98
101
|
offset = 0 # rollback to UTC
|
@@ -122,6 +125,7 @@ module FastExcel
|
|
122
125
|
end
|
123
126
|
|
124
127
|
|
128
|
+
ERROR_ENUM = Libxlsxwriter.enum_type(:error)
|
125
129
|
COLOR_ENUM = Libxlsxwriter.enum_type(:defined_colors)
|
126
130
|
EXTRA_COLORS = {
|
127
131
|
alice_blue: 0xF0F8FF,
|
@@ -363,10 +367,11 @@ module FastExcel
|
|
363
367
|
|
364
368
|
def add_worksheet(sheetname = nil)
|
365
369
|
if !sheetname.nil?
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
+
error = validate_worksheet_name(sheetname)
|
371
|
+
if error != :no_error
|
372
|
+
error_code = ERROR_ENUM.find(error)
|
373
|
+
error_str = error_code ? Libxlsxwriter.strerror(error_code) : ''
|
374
|
+
raise ArgumentError, "Invalid worksheet name '#{sheetname}': (#{error_code} - #{error}) #{error_str}"
|
370
375
|
end
|
371
376
|
end
|
372
377
|
|
data/test/validations_test.rb
CHANGED
@@ -11,7 +11,7 @@ describe "FastExcel validations" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
assert_equal(ArgumentError, error.class)
|
14
|
-
assert_equal("
|
14
|
+
assert_equal("Invalid worksheet name 'Payments Report': (16 - error_sheetname_already_used) Worksheet name is already in use.", error.message)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should not raise error when worksheet name is null" do
|
@@ -33,7 +33,7 @@ describe "FastExcel validations" do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
assert_equal(ArgumentError, error.class)
|
36
|
-
assert_equal("
|
36
|
+
assert_equal("Invalid worksheet name 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345': (13 - error_sheetname_length_exceeded) Worksheet name exceeds Excel's limit of 31 characters.", error.message)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should not raise error when the sheet name is at maximum length" do
|
@@ -44,4 +44,15 @@ describe "FastExcel validations" do
|
|
44
44
|
|
45
45
|
assert_equal("ABCDEFGHIJKLMNOPQRSTUVWXYZ01234", worksheet[:name])
|
46
46
|
end
|
47
|
+
|
48
|
+
it "should validate using Libxlsxwriter validation" do
|
49
|
+
workbook = FastExcel.open(constant_memory: true)
|
50
|
+
error = assert_raises do
|
51
|
+
worksheet = workbook.add_worksheet('a?')
|
52
|
+
worksheet.write_value(1, 1, 'a') # without the validation, this method will crash the process
|
53
|
+
end
|
54
|
+
|
55
|
+
assert_equal(ArgumentError, error.class)
|
56
|
+
assert_equal("Invalid worksheet name 'a?': (14 - error_invalid_sheetname_character) Worksheet name cannot contain invalid characters: '[ ] : * ? / \\'", error.message)
|
57
|
+
end
|
47
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_excel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Evstigneev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -39,17 +39,15 @@ extensions:
|
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
41
|
- ".dockerignore"
|
42
|
+
- ".github/workflows/test.yml"
|
42
43
|
- ".gitignore"
|
43
|
-
- ".travis.yml"
|
44
44
|
- CHANGELOG.md
|
45
45
|
- Dockerfile.test
|
46
46
|
- Gemfile
|
47
|
-
- Gemfile.lock
|
48
47
|
- LICENSE
|
49
48
|
- Makefile
|
50
49
|
- README.md
|
51
50
|
- Rakefile
|
52
|
-
- appveyor.yml
|
53
51
|
- benchmarks/1k_rows.rb
|
54
52
|
- benchmarks/20k_rows.rb
|
55
53
|
- benchmarks/auto_width.rb
|
@@ -173,7 +171,6 @@ files:
|
|
173
171
|
- test/format_test.rb
|
174
172
|
- test/reopen_test.rb
|
175
173
|
- test/test_helper.rb
|
176
|
-
- test/text_width_test.rb
|
177
174
|
- test/tmpfile_test.rb
|
178
175
|
- test/validations_test.rb
|
179
176
|
- test/worksheet_test.rb
|
@@ -199,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
196
|
- !ruby/object:Gem::Version
|
200
197
|
version: '0'
|
201
198
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
199
|
+
rubygems_version: 3.4.3
|
203
200
|
signing_key:
|
204
201
|
specification_version: 4
|
205
202
|
summary: Ultra Fast Excel Writer
|
data/.travis.yml
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
|
4
|
-
matrix:
|
5
|
-
include:
|
6
|
-
# - os: linux
|
7
|
-
# rvm: 2.2.10
|
8
|
-
# - os: osx
|
9
|
-
# rvm: 2.2.10
|
10
|
-
- os: linux
|
11
|
-
rvm: 2.3.8
|
12
|
-
- os: linux
|
13
|
-
rvm: 2.4.6
|
14
|
-
- os: osx
|
15
|
-
rvm: 2.4.6
|
16
|
-
- os: linux
|
17
|
-
rvm: 2.5.5
|
18
|
-
- os: osx
|
19
|
-
rvm: 2.5.5
|
20
|
-
- os: linux
|
21
|
-
rvm: 2.6.3
|
22
|
-
env: BUILD_DOCKER=true
|
23
|
-
services:
|
24
|
-
- docker
|
25
|
-
- os: osx
|
26
|
-
rvm: 2.6.3
|
27
|
-
osx_image: xcode10.2
|
28
|
-
before_script:
|
29
|
-
- ls -lah /Applications
|
30
|
-
- sudo xcode-select -s /Applications/Xcode-10.2.1.app/Contents/Developer
|
31
|
-
- clang --version
|
32
|
-
- os: linux
|
33
|
-
rvm: 2.7.2
|
34
|
-
- os: linux
|
35
|
-
rvm: 3.0.0-preview2
|
36
|
-
fast_finish: true
|
37
|
-
allow_failures:
|
38
|
-
- rvm: 3.0.0-preview2
|
39
|
-
|
40
|
-
before_install:
|
41
|
-
- gem install bundler -v 2.2.2
|
42
|
-
|
43
|
-
script:
|
44
|
-
- bundle install
|
45
|
-
- make
|
46
|
-
- bundle exec rake test
|
47
|
-
- bundle exec rake examples
|
48
|
-
- gem build fast_excel.gemspec
|
49
|
-
- export GIT_REPO=${TRAVIS_PULL_REQUEST_SLUG:-$TRAVIS_REPO_SLUG}
|
50
|
-
- env
|
51
|
-
- if [ -n "$BUILD_DOCKER" ]; then docker build . -f Dockerfile.test --build-arg GIT_REPO --build-arg TRAVIS_COMMIT --build-arg TRAVIS_BRANCH ; fi
|
data/Gemfile.lock
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/paxa/process_memory
|
3
|
-
revision: 282c75336a4a6b92207cd1eaa57f20887b92601e
|
4
|
-
specs:
|
5
|
-
process_memory (0.1)
|
6
|
-
|
7
|
-
GIT
|
8
|
-
remote: https://github.com/randym/axlsx.git
|
9
|
-
revision: 8e7b4b3b7259103452c191f73ce0bf64f66033fe
|
10
|
-
specs:
|
11
|
-
axlsx (3.0.0.pre)
|
12
|
-
htmlentities (~> 4.3, >= 4.3.4)
|
13
|
-
mimemagic (~> 0.3)
|
14
|
-
nokogiri (~> 1.8, >= 1.8.2)
|
15
|
-
rubyzip (~> 1.2, >= 1.2.1)
|
16
|
-
|
17
|
-
GIT
|
18
|
-
remote: https://github.com/roo-rb/roo.git
|
19
|
-
revision: d416f1520c50bbab160ca2ed9a49498fcc3edf50
|
20
|
-
tag: v2.8.3
|
21
|
-
specs:
|
22
|
-
roo (2.8.3)
|
23
|
-
nokogiri (~> 1)
|
24
|
-
rubyzip (>= 1.3.0, < 3.0.0)
|
25
|
-
|
26
|
-
GEM
|
27
|
-
remote: https://rubygems.org/
|
28
|
-
specs:
|
29
|
-
ansi (1.5.0)
|
30
|
-
benchmark-ips (2.8.4)
|
31
|
-
builder (3.2.4)
|
32
|
-
ffi (1.14.2)
|
33
|
-
ffi_gen (1.2.0)
|
34
|
-
ffi (~> 1.0)
|
35
|
-
htmlentities (4.3.4)
|
36
|
-
mimemagic (0.3.5)
|
37
|
-
minitest (5.14.3)
|
38
|
-
minitest-reporters (1.4.3)
|
39
|
-
ansi
|
40
|
-
builder
|
41
|
-
minitest (>= 5.0)
|
42
|
-
ruby-progressbar
|
43
|
-
nokogiri (1.11.1-x86_64-darwin)
|
44
|
-
racc (~> 1.4)
|
45
|
-
nokogiri (1.11.1-x86_64-linux)
|
46
|
-
racc (~> 1.4)
|
47
|
-
racc (1.5.2)
|
48
|
-
rake (13.0.3)
|
49
|
-
ruby-progressbar (1.11.0)
|
50
|
-
rubyzip (1.3.0)
|
51
|
-
write_xlsx (1.04.0)
|
52
|
-
rubyzip (>= 1.0.0)
|
53
|
-
zip-zip
|
54
|
-
xlsxtream (2.4.0)
|
55
|
-
zip_tricks (>= 4.5, < 6)
|
56
|
-
zip-zip (0.3)
|
57
|
-
rubyzip (>= 1.0.0)
|
58
|
-
zip_tricks (5.5.0)
|
59
|
-
|
60
|
-
PLATFORMS
|
61
|
-
ruby
|
62
|
-
x86_64-darwin-19
|
63
|
-
x86_64-linux
|
64
|
-
|
65
|
-
DEPENDENCIES
|
66
|
-
axlsx!
|
67
|
-
benchmark-ips
|
68
|
-
ffi
|
69
|
-
ffi_gen
|
70
|
-
minitest
|
71
|
-
minitest-reporters
|
72
|
-
process_memory!
|
73
|
-
rake
|
74
|
-
roo (= 2.8.3)!
|
75
|
-
write_xlsx
|
76
|
-
xlsxtream
|
77
|
-
|
78
|
-
BUNDLED WITH
|
79
|
-
2.2.2
|
data/appveyor.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
install:
|
2
|
-
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
3
|
-
- SET PATH=C:\MinGW\bin;%PATH%
|
4
|
-
- SET RAKEOPT=-rdevkit
|
5
|
-
- copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe
|
6
|
-
- ruby --version
|
7
|
-
- gem --version
|
8
|
-
- bundle install
|
9
|
-
- make
|
10
|
-
|
11
|
-
build: off
|
12
|
-
|
13
|
-
test_script:
|
14
|
-
- bundle exec rake test
|
15
|
-
|
16
|
-
environment:
|
17
|
-
matrix:
|
18
|
-
- ruby_version: "24"
|
19
|
-
- ruby_version: "24-x64"
|
20
|
-
- ruby_version: "23"
|
21
|
-
- ruby_version: "23-x64"
|
22
|
-
- ruby_version: "22"
|
23
|
-
- ruby_version: "22-x64"
|
24
|
-
- ruby_version: "21"
|
25
|
-
- ruby_version: "21-x64"
|
data/test/text_width_test.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
|
3
|
-
|
4
|
-
describe "FastExcel Arial text_width" do
|
5
|
-
|
6
|
-
before do
|
7
|
-
skip "Use basic width calc for now"
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should calculate width for character" do
|
11
|
-
assert_in_delta(FastExcel.arial_text_width('a'), 55.61, 0.1)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should calculate width with kerning" do
|
15
|
-
assert_in_delta(FastExcel.arial_text_width('A'), 66.69, 0.1)
|
16
|
-
assert_in_delta(FastExcel.arial_text_width('V'), 66.69, 0.1)
|
17
|
-
|
18
|
-
assert_in_delta(FastExcel.arial_text_width('AV'), 125.97, 0.1)
|
19
|
-
|
20
|
-
assert_in_delta(FastExcel.arial_text_width('11'), 103.80, 0.1)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should skip system characters" do
|
24
|
-
assert_in_delta(FastExcel.arial_text_width(10.chr), 0.0)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should handle multiline text" do
|
28
|
-
assert_in_delta(FastExcel.arial_text_width("More\nThen\nOne Line"), 405.85, 0.1)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "FastExcel Calibri text_width" do
|
33
|
-
|
34
|
-
before do
|
35
|
-
skip "Use basic width calc for now"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should calculate width for character" do
|
39
|
-
assert_in_delta(FastExcel.calibri_text_width('a'), 47.90, 0.1)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should calculate width with kerning" do
|
43
|
-
assert_in_delta(FastExcel.calibri_text_width('A'), 57.86, 0.1)
|
44
|
-
assert_in_delta(FastExcel.calibri_text_width('V'), 56.73, 0.1)
|
45
|
-
|
46
|
-
assert_in_delta(FastExcel.calibri_text_width('AV'), 110.25, 0.1)
|
47
|
-
|
48
|
-
assert_in_delta(FastExcel.calibri_text_width('11'), 101.36, 0.1)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should skip system characters" do
|
52
|
-
assert_in_delta(FastExcel.calibri_text_width(10.chr), 0.0)
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "FastExcel Times New Roman text_width" do
|
58
|
-
|
59
|
-
before do
|
60
|
-
skip "Use basic width calc for now"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should calculate width for character" do
|
64
|
-
assert_in_delta(FastExcel.times_new_roman_text_width('a'), 44.38, 0.1)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should calculate width with kerning" do
|
68
|
-
assert_in_delta(FastExcel.times_new_roman_text_width('A'), 72.21, 0.1)
|
69
|
-
assert_in_delta(FastExcel.times_new_roman_text_width('V'), 72.21, 0.1)
|
70
|
-
|
71
|
-
assert_in_delta(FastExcel.times_new_roman_text_width('AV'), 131.54, 0.1)
|
72
|
-
|
73
|
-
assert_in_delta(FastExcel.times_new_roman_text_width('11'), 96.28, 0.1)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should skip system characters" do
|
77
|
-
assert_in_delta(FastExcel.times_new_roman_text_width(10.chr), 0.0)
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|