You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.3 KiB

1 month ago
# テスト用スクリプト - Convert-Pdf.ps1のテスト実行
# 現在のプロジェクトのJARファイルを使用したテスト
$jarPath = "build\libs\pdf-memo-layers.jar"
$samplesDir = "samples"
Write-Host "=== Convert-Pdf.ps1 テスト実行 ===" -ForegroundColor Green
# JARファイルの存在確認
if (-not (Test-Path $jarPath)) {
Write-Host "エラー: JARファイルが見つかりません: $jarPath" -ForegroundColor Red
Write-Host "まず 'gradlew build' または 'gradlew fatJar' を実行してください" -ForegroundColor Yellow
exit 1
}
# サンプルディレクトリの存在確認
if (-not (Test-Path $samplesDir)) {
Write-Host "エラー: samplesディレクトリが見つかりません" -ForegroundColor Red
exit 1
}
# 1. DryRunテスト
Write-Host "`n1. DryRunテスト実行中..." -ForegroundColor Cyan
.\Convert-Pdf.ps1 `
-RootDir $samplesDir `
-Converter "java -jar `"$jarPath`" --in `"{input}`" --out `"{output}`"" `
-DryRun
# 2. 実際の変換テスト(単一ファイル処理)
Write-Host "`n2. 実際の変換テスト(順次処理)..." -ForegroundColor Cyan
.\Convert-Pdf.ps1 `
-RootDir $samplesDir `
-Converter "java -jar `"$jarPath`" --in `"{input}`" --out `"{output}`"" `
-Concurrency 1 `
-Log "convert-test.log"
# 3. 並列処理テスト
Write-Host "`n3. 並列処理テスト..." -ForegroundColor Cyan
.\Convert-Pdf.ps1 `
-RootDir $samplesDir `
-Converter "java -jar `"$jarPath`" --in `"{input}`" --out `"{output}`"" `
-Concurrency 2 `
-Log "convert-parallel-test.log" `
-Force
# 4. 出力先指定テスト
Write-Host "`n4. 出力先指定テスト..." -ForegroundColor Cyan
$outputDir = "test-output"
if (Test-Path $outputDir) {
Remove-Item $outputDir -Recurse -Force
}
.\Convert-Pdf.ps1 `
-RootDir $samplesDir `
-Converter "java -jar `"$jarPath`" --in `"{input}`" --out `"{output}`"" `
-OutputRoot $outputDir `
-Log "convert-output-test.log"
Write-Host "`n=== テスト完了 ===" -ForegroundColor Green
Write-Host "生成されたファイルを確認してください:" -ForegroundColor Yellow
Write-Host "- samplesディレクトリ内の *.converted.pdf ファイル"
Write-Host "- test-outputディレクトリ内のファイル"
Write-Host "- ログファイル: convert-*.log"