arbeiten an Tests

This commit is contained in:
chk
2026-05-25 09:50:05 +02:00
parent 99794b944d
commit 6e770c170a
10 changed files with 65 additions and 31 deletions

View File

@@ -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"
}
]
}

View File

@@ -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();
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB