arbeiten an Tests
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
const BASE_PATH = path.join(__dirname, '..');
|
||||
@@ -10,43 +9,40 @@ const screenshotFiles = [
|
||||
'snapshot_video1_1778819665744.jpg',
|
||||
];
|
||||
|
||||
let tempDir;
|
||||
const SOURCE_DIR = path.join(__dirname, 'data', 'screenShots');
|
||||
const DEST_DIR = path.join(__dirname, 'data', 'screenshots', '1778819665744_twoCam_testResults');
|
||||
|
||||
describe('Camera Pose Script', () => {
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'AA_readTwoImages-'));
|
||||
const sourceDir = path.join(__dirname, 'data', 'screenShots');
|
||||
|
||||
if (!fs.existsSync(DEST_DIR)) {
|
||||
fs.mkdirSync(DEST_DIR, { recursive: true });
|
||||
}
|
||||
screenshotFiles.forEach((file) => {
|
||||
const src = path.join(sourceDir, file);
|
||||
const dst = path.join(tempDir, file);
|
||||
const src = path.join(SOURCE_DIR, file);
|
||||
if (!fs.existsSync(src)) {
|
||||
throw new Error(`Missing test fixture screenshot: ${src}`);
|
||||
}
|
||||
fs.copyFileSync(src, dst);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (tempDir && fs.existsSync(tempDir)) {
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
// Keep generated outputs for inspection.
|
||||
});
|
||||
|
||||
test('should execute readTwoImages without modifying shared fixtures', () => {
|
||||
const strFile0 = path.join(tempDir, 'snapshot_video0_1778819665744.jpg');
|
||||
const strFile1 = path.join(tempDir, 'snapshot_video1_1778819665744.jpg');
|
||||
const strFile0 = path.join(SOURCE_DIR, 'snapshot_video0_1778819665744.jpg');
|
||||
const strFile1 = path.join(SOURCE_DIR, 'snapshot_video1_1778819665744.jpg');
|
||||
const command2 = `${PYTHON_CMD} "${path.join(BASE_PATH, 'programs/readTwoImages.py')}" \
|
||||
-i "${strFile0}" \
|
||||
-i "${strFile1}" \
|
||||
-npz "${path.join(BASE_PATH, 'data/settings/callibration_cam0.npz')}" \
|
||||
-npz "${path.join(BASE_PATH, 'data/settings/callibration_cam1.npz')}" \
|
||||
-settings "${path.join(BASE_PATH, 'data/settings/settings1m.json')}"`;
|
||||
-settings "${path.join(BASE_PATH, 'data/settings/settings1m.json')}" \
|
||||
--outDir "${DEST_DIR}"`;
|
||||
|
||||
try {
|
||||
expect(() => {
|
||||
execSync(command2, { stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
fail(`Failed to execute command: ${error.message}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user