arbeiten an Tests
This commit is contained in:
@@ -5,11 +5,40 @@
|
||||
"image":[
|
||||
{
|
||||
"timestamp":11778819665744,
|
||||
"file":"test/data/screenShots/snapshot_video0_11778819665744.jpg"
|
||||
"file":"test/data/screenShots/snapshot_video0_11778819665744.jpg",
|
||||
"camera":"c310",
|
||||
"callibration":"data/settings/callibration_cam0.npz"
|
||||
},
|
||||
{
|
||||
"timestamp":11778819665744,
|
||||
"file":"test/data/screenShots/snapshot_video1_11778819665744.jpg"
|
||||
"file":"test/data/screenShots/snapshot_video1_11778819665744.jpg",
|
||||
"camera":"c310",
|
||||
"callibration":"data/settings/callibration_cam0.npz"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"Test 1: 45° unterarm",
|
||||
"robot":"test/data/robot/robot.json",
|
||||
"timestamp":1779690911822,
|
||||
"image":[
|
||||
{
|
||||
"timestamp":1779690911822,
|
||||
"file":"test/data/screenShots/snapshot_video0_1779690911822.jpg",
|
||||
"camera":"c310",
|
||||
"callibration":"data/settings/callibration_cam0.npz"
|
||||
},
|
||||
{
|
||||
"timestamp":1779690911822,
|
||||
"file":"test/data/screenShots/snapshot_video0_1779690911822.jpg",
|
||||
"camera":"c310",
|
||||
"callibration":"data/settings/callibration_cam0.npz"
|
||||
},
|
||||
{
|
||||
"timestamp":1779690911822,
|
||||
"file":"test/data/screenShots/1779690911822_DSCF1382.JPG",
|
||||
"camera":"XT1",
|
||||
"callibration":"data/callibration/XT1-16mm28-1mFokus_f8/callibration_XT1-16mm_1m_f8.npz"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
BIN
test/data/screenShots/1779690911822_DSCF1382.JPG
Normal file
BIN
test/data/screenShots/1779690911822_DSCF1382.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 MiB |
BIN
test/data/screenShots/DSCF1379.JPG
Normal file
BIN
test/data/screenShots/DSCF1379.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 MiB |
BIN
test/data/screenShots/DSCF1380.JPG
Normal file
BIN
test/data/screenShots/DSCF1380.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 MiB |
BIN
test/data/screenShots/DSCF1381.JPG
Normal file
BIN
test/data/screenShots/DSCF1381.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 MiB |
BIN
test/data/screenShots/DSCF1383.JPG
Normal file
BIN
test/data/screenShots/DSCF1383.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 MiB |
Reference in New Issue
Block a user