Skip to content

Commit

Permalink
wrapper tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonowl committed Sep 13, 2024
1 parent a8edd5c commit 1e2078a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/python-wrapper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: python-wrapper
on: [push, pull_request]
jobs:
run_python_spec_in_default_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Running units
run: |
docker build -t doc-builder-python-wrapper .
docker run -t doc-builder-python-wrapper python_spec
run_python_spec_in_all_dockerfiles:
runs-on: ubuntu-latest
strategy:
matrix:
dockerfiles:
- "dockerfiles/rockylinux-latest/Dockerfile"
- "dockerfiles/debian-develop/Dockerfile"
- "dockerfiles/debian-next-release/Dockerfile"
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Dockerfile ${{ matrix.dockerfiles }}
run: |
docker build -t doc-builder-python-wrapper -f ${{ matrix.dockerfiles }} .
docker run -t doc-builder-python-wrapper python_spec
3 changes: 2 additions & 1 deletion python/wrapper/smoke/doc_builder_value/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
paragraph.Call("AddComment", "Comment one", "John", "uid-1")

comments = document.Call("GetAllComments")
comment = comments.Get(0)
paragraph.Call("AddLineBreak")
paragraph.Call("AddText", f"Comment text is {comments.Get(0).Call("GetText").ToString()}")
paragraph.Call("AddText", f'Comment text is {comment.Call("GetText").ToString()}')

builder.SaveFile("docx", "Get.docx")
builder.CloseFile()
4 changes: 2 additions & 2 deletions python/wrapper/smoke/doc_builder_value/is_double.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png",
60 * 36000, 35 * 36000)
paragraph.Call("AddDrawing", image)
paragraph.Call("AddText", f"Width is double = {image.Call("GetWidth").IsDouble()}")
paragraph.Call("AddText", f'Width is double = {image.Call("GetWidth").IsDouble()}')
paragraph.Call("AddLineBreak")
paragraph.Call("AddText", f"LockValue is double = {image.Call("GetLockValue").IsDouble()}")
paragraph.Call("AddText", f'LockValue is double = {image.Call("GetLockValue").IsDouble()}')

builder.SaveFile("docx", "IsDouble.docx")
builder.CloseFile()
9 changes: 2 additions & 7 deletions python/wrapper/smoke/doc_builder_value/to_bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@

document = api.Call("GetDocument")
paragraph = document.Call("GetElement", 0)
paragraph.Call("AddText", "Some text")
paragraph.Call("AddComment", "Comment one", "John", "uid-1")

comments = document.Call("GetAllComments")
delete = comments[0].Call("Delete")
paragraph.Call("AddLineBreak")
paragraph.Call("AddText", f"Delete result = {delete.ToBool()}")
track_revisions = document.Call("IsTrackRevisions")
paragraph.Call("AddText", f"IsTrackRevisions = {track_revisions.ToBool()}")

builder.SaveFile("docx", "ToBool.docx")
builder.CloseFile()
2 changes: 1 addition & 1 deletion python/wrapper/smoke/doc_builder_value/to_double.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png",
60 * 36000, 35 * 36000)
paragraph.Call("AddDrawing", image)
paragraph.Call("AddText", f"Width = {image.Call("GetWidth").ToDouble()}")
paragraph.Call("AddText", f'Width = {image.Call("GetWidth").ToDouble()}')

builder.SaveFile("docx", "ToDouble.docx")
builder.CloseFile()
2 changes: 1 addition & 1 deletion python_spec/wrapper/smoke/doc_builder_value_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

it 'CDocBuilderValue | ToBool method' do
docx = builder.build_and_parse('python/wrapper/smoke/doc_builder_value/to_bool.py')
expect(docx.elements.first.nonempty_runs[2].text).to eq('Delete result = True')
expect(docx.elements.first.nonempty_runs[0].text).to eq('IsTrackRevisions = False')
end

it 'CDocBuilderValue | ToDouble method' do
Expand Down

0 comments on commit 1e2078a

Please sign in to comment.