Skip to content

Commit

Permalink
Merge branch 'feature/all_object_to_json' into fork/all_object_to_json
Browse files Browse the repository at this point in the history
  • Loading branch information
Yar04ek authored Nov 29, 2023
2 parents cbaf606 + c9b8a1d commit 16101ff
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-10-24 19:07:30 UTC using RuboCop version 1.57.1.
# on 2023-11-28 10:56:01 UTC using RuboCop version 1.57.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# Offense count: 4
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 16
Max: 21

# Offense count: 116
# Offense count: 121
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 21
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GEM
jwt (2.7.1)
language_server-protocol (3.17.0.3)
mini_portile2 (2.8.5)
nokogiri (1.15.4)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
onlyoffice_pdf_parser (0.5.0)
Expand Down Expand Up @@ -43,7 +43,7 @@ GEM
hashery (~> 2.0)
ruby-rc4
ttfunk
pkg-config (1.5.5)
pkg-config (1.5.6)
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/debian-next-release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ruby:3.2

MAINTAINER Pavel.Lobashov "[email protected]"
ENV VERSION="7.5.1"
ENV VERSION="7.6.0"
ENV DIST="stable"

RUN apt-get update && apt-get -y -q install git \
Expand Down
8 changes: 3 additions & 5 deletions lib/doc_builder_testing.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# frozen_string_literal: true

require 'tempfile'
require 'ooxml_parser'
require 'onlyoffice_pdf_parser'
require 'tempfile'
require_relative 'doc_builder_testing/doc_builder_wrapper'
require_relative 'doc_builder_testing/exceptions'
require_relative 'doc_builder_testing/web_doc_builder_wrapper'
require_relative '../spec/test_data'
require_relative 'doc_builder_static_data'
require_relative 'doc_builder_testing/doc_builder_wrapper'
require_relative 'doc_builder_testing/web_doc_builder_wrapper'
29 changes: 28 additions & 1 deletion spec/test_data.rb → spec/doc_builder_static_data.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# frozen_string_literal: true

# Test data for autotest
module TestData
module DocBuilderStaticData
# CDE number formats (7.4.0)
# @return [Array<String (frozen)>]
def self.number_formats
['General',
'0.00',
Expand All @@ -17,6 +18,32 @@ def self.number_formats
'0.00E+00'].freeze
end

# Default style list for CDE v7.4.1
# @return [Array<String (frozen)>]
def self.cde_styles
['Normal',
'No Spacing',
'Heading 1',
'Heading 2',
'Heading 3',
'Heading 4',
'Heading 5',
'Heading 6',
'Heading 7',
'Heading 8',
'Heading 9',
'Title',
'Subtitle',
'Quote',
'Intense Quote',
'List Paragraph',
'Caption',
'Header',
'Footer',
'Footnote text',
'Endnote text'].freeze
end

# @return [Array<String (frozen)>]
def self.libs
%w[DjVuFile.dll
Expand Down
2 changes: 1 addition & 1 deletion spec/doc_builder_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
end

describe 'check windows build libs', :win do
TestData.libs.each do |lib|
DocBuilderStaticData.libs.each do |lib|
it lib.to_s do
skip('[WIN] check build libs') unless Gem.win_platform?
expect(arr_libs).to include(lib)
Expand Down
2 changes: 1 addition & 1 deletion spec/docx/smoke/api_document_content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
docx = builder.build_and_parse('js/docx/smoke/api_document_content/to_json.js')
expect(docx.elements[0].hyperlink.action.to_s).to eq('external_link')
expect(docx.elements[1].sdt_content.elements[1].character_style_array[0].text).to eq('oBlockLvlSdt')
expect(docx.elements[2].properties.table_style.style_id).to eq(DocBuilderStaticData::TABLE_STYLE[:BorderedAccent5])
expect(docx.elements[2].properties.table_style.name).to eq('CustomTableStyle')
json = JSON.parse(docx.elements[5].nonempty_runs.first.text)
expect(json['type']).to eq('docContent')
expect(json['content'][0]['content'][2]['type']).to eq('hyperlink')
Expand Down
2 changes: 1 addition & 1 deletion spec/docx/smoke/api_style_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
it 'ApiStyle | ToJSON method' do
docx = builder.build_and_parse('js/docx/smoke/api_style/to_json.js')
json = JSON.parse(docx.elements[22].nonempty_runs[0].text)
DocBuilderStaticData::DEFAULT_STYLES.each_with_index do |style, index|
DocBuilderStaticData.cde_styles.each_with_index do |style, index|
# TODO: To understand why incorrect names are recorded
next if (style == 'Header') || # in the metadata: Custom_Style 719 styleId: 42
(style == 'Footer') || # in the metadata: Custom_Style 725 styleId: 44
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'bundler/setup'
require 'rspec'
require_relative '../lib/doc_builder_testing'
require_relative 'doc_builder_static_data'

# Get either DocBuilder of WebDocBuilder
# depending of env var
Expand Down
8 changes: 2 additions & 6 deletions spec/xlsx/smoke/api_range_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

require 'spec_helper'
describe 'ApiRange section tests' do
before do
include TestData
end

it 'ApiRange | GetCol method' do
xlsx = builder.build_and_parse('js/xlsx/smoke/api_range/get_col.js')
expect(xlsx.worksheets.first.rows[1].cells.first.text).to eq('4')
Expand Down Expand Up @@ -83,7 +79,7 @@

it 'ApiRange | NumberFormat method' do
xlsx = builder.build_and_parse('js/xlsx/smoke/api_range/setter_number_format.js')
TestData.number_formats.each_with_index do |format, i|
DocBuilderStaticData.number_formats.each_with_index do |format, i|
expect(xlsx.worksheets.first.rows[i + 1].cells[0].raw_text).to eq('123456')
expect(xlsx.worksheets.first.rows[i + 1].cells[0].style.numerical_format).to eq(format)
end
Expand All @@ -92,7 +88,7 @@

it 'ApiRange | GetNumberFormat' do
xlsx = builder.build_and_parse('js/xlsx/smoke/api_range/get_number_format.js')
TestData.number_formats.each_with_index do |format, i|
DocBuilderStaticData.number_formats.each_with_index do |format, i|
expect(xlsx.worksheets.first.rows[i + 1].cells[2].raw_text).to eq('123456')
expect(xlsx.worksheets.first.rows[i + 1].cells[2].style.numerical_format).to eq(format)
end
Expand Down

0 comments on commit 16101ff

Please sign in to comment.