This commit is contained in:
parent
87c0a1611e
commit
a861c7e90c
5 changed files with 25 additions and 15 deletions
|
@ -15,18 +15,18 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
java-version: '17'
|
||||
|
||||
- name: Install BaseX
|
||||
run: |
|
||||
wget http://files.basex.org/releases/9.6.3/BaseX963.zip
|
||||
unzip BaseX963.zip -d basex
|
||||
wget https://files.basex.org/releases/10.7/BaseX107.zip
|
||||
unzip BaseX107.zip -d basex
|
||||
|
||||
- name: Run BaseX Tests
|
||||
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';
|
||||
|
||||
declare variable $urls := (
|
||||
declare variable $maven-urls := (
|
||||
"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/fontbox/3.0.4/fontbox-3.0.4.jar",
|
||||
|
@ -16,7 +16,7 @@ let $config :=map {
|
|||
"main-class": "org.expkg_zone58.Pdfbox3"
|
||||
}
|
||||
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: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 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()
|
||||
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 :)
|
||||
|
@ -49,7 +51,7 @@ returned as string to avoid float rounding issues
|
|||
:)
|
||||
declare function pdfbox:specification($pdf as item())
|
||||
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 :)
|
||||
|
|
|
@ -10,7 +10,7 @@ declare variable $test:base:=file:base-dir()=>file:parent()=>file:parent();
|
|||
declare %unit:test
|
||||
function test:pdfbox-version(){
|
||||
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
|
||||
|
@ -49,11 +49,12 @@ function test:outline-xml(){
|
|||
};
|
||||
|
||||
declare %unit:test
|
||||
function test:pagelabels(){
|
||||
function test:labels(){
|
||||
let $pdf:=test:pdf("samples.pdf/BaseX100.pdf")
|
||||
|
||||
let $labels:=pdfbox:labels($pdf)
|
||||
let $labels:=pdfbox:labels($pdf)
|
||||
return (
|
||||
unit:assert-equals(count($labels),pdfbox:page-count($pdf)),
|
||||
unit:assert($labels[1]="i") ,
|
||||
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"))
|
||||
};
|
||||
|
||||
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)
|
||||
as item(){
|
||||
file:resolve-path($file,$test:base)=>pdfbox:open()
|
||||
|
|
Loading…
Add table
Reference in a new issue