This commit is contained in:
parent
87c0a1611e
commit
a861c7e90c
5 changed files with 25 additions and 15 deletions
|
@ -15,18 +15,18 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Java
|
- name: Set up Java
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
|
|
||||||
- name: Install BaseX
|
- name: Install BaseX
|
||||||
run: |
|
run: |
|
||||||
wget http://files.basex.org/releases/9.6.3/BaseX963.zip
|
wget https://files.basex.org/releases/10.7/BaseX107.zip
|
||||||
unzip BaseX963.zip -d basex
|
unzip BaseX107.zip -d basex
|
||||||
|
|
||||||
- name: Run BaseX Tests
|
- name: Run BaseX Tests
|
||||||
run: |
|
run: |
|
||||||
./basex/bin/basex -c"RUN tests/test.bxs"
|
./basex/bin/basex -t /src/test
|
|
@ -1 +1 @@
|
||||||
!rddd.
|
30/1
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import module namespace build = 'urn:quodatum:build1' at 'build.xqm';
|
import module namespace build = 'urn:quodatum:build1' at 'build.xqm';
|
||||||
|
|
||||||
declare variable $urls := (
|
declare variable $maven-urls := (
|
||||||
"org/apache/pdfbox/pdfbox/3.0.4/pdfbox-3.0.4.jar",
|
"org/apache/pdfbox/pdfbox/3.0.4/pdfbox-3.0.4.jar",
|
||||||
"org/apache/pdfbox/pdfbox-io/3.0.4/pdfbox-io-3.0.4.jar",
|
"org/apache/pdfbox/pdfbox-io/3.0.4/pdfbox-io-3.0.4.jar",
|
||||||
"org/apache/pdfbox/fontbox/3.0.4/fontbox-3.0.4.jar",
|
"org/apache/pdfbox/fontbox/3.0.4/fontbox-3.0.4.jar",
|
||||||
|
@ -16,7 +16,7 @@ let $config :=map {
|
||||||
"main-class": "org.expkg_zone58.Pdfbox3"
|
"main-class": "org.expkg_zone58.Pdfbox3"
|
||||||
}
|
}
|
||||||
let $jar-path:=file:resolve-path($config?input-dir,$config?base=>trace("base "))=>trace("jar: ")
|
let $jar-path:=file:resolve-path($config?input-dir,$config?base=>trace("base "))=>trace("jar: ")
|
||||||
let $_:=build:maven-download($urls,$jar-path)
|
let $_:=build:maven-download($maven-urls,$jar-path)
|
||||||
let $fat-jar := build:fatjar-from-folder($jar-path,$config?manifest-jar)
|
let $fat-jar := build:fatjar-from-folder($jar-path,$config?manifest-jar)
|
||||||
|
|
||||||
let $fat-jar:=build:update-manifest($fat-jar, $config?main-class)
|
let $fat-jar:=build:update-manifest($fat-jar, $config?main-class)
|
||||||
|
|
|
@ -28,10 +28,12 @@ declare namespace PDFRenderer="java:org.apache.pdfbox.rendering.PDFRenderer";
|
||||||
declare namespace RandomAccessReadBufferedFile = "java:org.apache.pdfbox.io.RandomAccessReadBufferedFile";
|
declare namespace RandomAccessReadBufferedFile = "java:org.apache.pdfbox.io.RandomAccessReadBufferedFile";
|
||||||
declare namespace File ="java:java.io.File";
|
declare namespace File ="java:java.io.File";
|
||||||
|
|
||||||
(:~ version of Apacke Pdfbox in use :)
|
(:~ version of this package
|
||||||
|
with build metadata for Apacke Pdfbox in use e.g. "0.1.0+pdfbox3.0.4"
|
||||||
|
:)
|
||||||
declare function pdfbox:version()
|
declare function pdfbox:version()
|
||||||
as xs:string{
|
as xs:string{
|
||||||
Q{java:org.apache.pdfbox.util.Version}getVersion()
|
"0.1.0+pdfbox" || Q{java:org.apache.pdfbox.util.Version}getVersion()
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~ open pdf, returns pdf object :)
|
(:~ open pdf, returns pdf object :)
|
||||||
|
@ -49,7 +51,7 @@ returned as string to avoid float rounding issues
|
||||||
:)
|
:)
|
||||||
declare function pdfbox:specification($pdf as item())
|
declare function pdfbox:specification($pdf as item())
|
||||||
as xs:string{
|
as xs:string{
|
||||||
PDDocument:getVersion($pdf)=>xs:decimal()=>round(4)
|
PDDocument:getVersion($pdf)=>xs:decimal()=>round(4)=>string()
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~ save pdf $pdf to $savepath , returns $savepath :)
|
(:~ save pdf $pdf to $savepath , returns $savepath :)
|
||||||
|
|
|
@ -10,7 +10,7 @@ declare variable $test:base:=file:base-dir()=>file:parent()=>file:parent();
|
||||||
declare %unit:test
|
declare %unit:test
|
||||||
function test:pdfbox-version(){
|
function test:pdfbox-version(){
|
||||||
let $v:= pdfbox:version()=>trace("VER: ")
|
let $v:= pdfbox:version()=>trace("VER: ")
|
||||||
return unit:assert-equals($v,"3.0.4")
|
return unit:assert-equals($v,"0.1.0+pdfbox3.0.4")
|
||||||
};
|
};
|
||||||
|
|
||||||
declare %unit:test
|
declare %unit:test
|
||||||
|
@ -49,11 +49,12 @@ function test:outline-xml(){
|
||||||
};
|
};
|
||||||
|
|
||||||
declare %unit:test
|
declare %unit:test
|
||||||
function test:pagelabels(){
|
function test:labels(){
|
||||||
let $pdf:=test:pdf("samples.pdf/BaseX100.pdf")
|
let $pdf:=test:pdf("samples.pdf/BaseX100.pdf")
|
||||||
|
|
||||||
let $labels:=pdfbox:labels($pdf)
|
let $labels:=pdfbox:labels($pdf)
|
||||||
return (
|
return (
|
||||||
|
unit:assert-equals(count($labels),pdfbox:page-count($pdf)),
|
||||||
unit:assert($labels[1]="i") ,
|
unit:assert($labels[1]="i") ,
|
||||||
unit:assert($labels[27]="1")
|
unit:assert($labels[27]="1")
|
||||||
)
|
)
|
||||||
|
@ -74,6 +75,13 @@ let $pdf:=test:pdf("samples.pdf/BaseX100.pdf")
|
||||||
return unit:assert(starts-with($text,"BaseX Documentation"))
|
return unit:assert(starts-with($text,"BaseX Documentation"))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare %unit:test
|
||||||
|
function test:page-image(){
|
||||||
|
let $pdf:=test:pdf("samples.pdf/BaseX100.pdf")
|
||||||
|
let $image:=pdfbox:page-image($pdf,0,map{})
|
||||||
|
return unit:assert(true())
|
||||||
|
};
|
||||||
|
|
||||||
declare function test:pdf($file as xs:string)
|
declare function test:pdf($file as xs:string)
|
||||||
as item(){
|
as item(){
|
||||||
file:resolve-path($file,$test:base)=>pdfbox:open()
|
file:resolve-path($file,$test:base)=>pdfbox:open()
|
||||||
|
|
Loading…
Add table
Reference in a new issue