mirror of
https://github.com/Melorise/TamaASR.git
synced 2026-11-07 14:39:32 +00:00
feat: 发布 MeloASR 0.1.7
整合 Linux Fcitx5 实时输入、网页后端、设置页、悬浮球、托盘和发行打包能力。 AI-assisted-by: Codex AI-model: gpt-5.6-sol AI-reasoning-effort: medium Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { resolveAutoStartAction } from '../src/main/auto-start-policy';
|
||||
|
||||
test('开发模式不创建用户级自启动覆盖文件', () => {
|
||||
assert.equal(resolveAutoStartAction(false, true), 'unchanged');
|
||||
assert.equal(resolveAutoStartAction(false, false), 'unchanged');
|
||||
});
|
||||
|
||||
test('安装包启用自启动时移除用户级覆盖,交由系统 desktop 文件启动', () => {
|
||||
assert.equal(resolveAutoStartAction(true, true), 'remove-user-override');
|
||||
});
|
||||
|
||||
test('安装包关闭自启动时写入 Hidden 覆盖', () => {
|
||||
assert.equal(resolveAutoStartAction(true, false), 'write-hidden-override');
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { resolveDebugLoginAction } from '../src/main/debug-login-flow';
|
||||
|
||||
test('首次打开调试页时先显示应用内登录提示', () => {
|
||||
assert.deepEqual(resolveDebugLoginAction(false, false), { action: 'prompt', markShown: false });
|
||||
});
|
||||
|
||||
test('用户确认或已经提示过时直接打开调试页', () => {
|
||||
assert.deepEqual(resolveDebugLoginAction(false, true), { action: 'open', markShown: true });
|
||||
assert.deepEqual(resolveDebugLoginAction(true, false), { action: 'open', markShown: false });
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { shouldClickMicrophoneOnCancel } from '../src/preload/speech-session-state';
|
||||
|
||||
test('停止命令已经点击过麦克风后,取消不得再次点击并重新开启录音', () => {
|
||||
assert.equal(shouldClickMicrophoneOnCancel(true, true), false);
|
||||
});
|
||||
|
||||
test('录音期间直接取消时仍应点击麦克风停止网页录音', () => {
|
||||
assert.equal(shouldClickMicrophoneOnCancel(true, false), true);
|
||||
});
|
||||
|
||||
test('本地会话未激活时取消不得点击麦克风', () => {
|
||||
assert.equal(shouldClickMicrophoneOnCancel(false, false), false);
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { decideOperationalStatus } from '../src/backends/status-decision';
|
||||
|
||||
test('登录入口存在时不得被编辑器和麦克风误判为已登录', () => {
|
||||
assert.deepEqual(decideOperationalStatus(true, true, true), {
|
||||
loginStatus: 'logged-out',
|
||||
ready: false,
|
||||
message: '尚未登录'
|
||||
});
|
||||
});
|
||||
|
||||
test('对话页具备编辑器和麦克风时允许录音', () => {
|
||||
assert.deepEqual(decideOperationalStatus(true, true, false), {
|
||||
loginStatus: 'logged-in',
|
||||
ready: true
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { shouldFinishAfterStop } from '../src/preload/stop-completion';
|
||||
|
||||
const base = {
|
||||
elapsedMs: 700,
|
||||
quietMs: 500,
|
||||
wasRecordingAtStop: true,
|
||||
isRecording: false,
|
||||
minimumWaitMs: 250,
|
||||
quietWindowMs: 450,
|
||||
timeoutMs: 4_500
|
||||
};
|
||||
|
||||
test('网页仍在录音时不得提前提交', () => {
|
||||
assert.equal(shouldFinishAfterStop({ ...base, isRecording: true }), false);
|
||||
});
|
||||
|
||||
test('网页结束且最终文本静默窗口满足时立即提交', () => {
|
||||
assert.equal(shouldFinishAfterStop(base), true);
|
||||
});
|
||||
|
||||
test('网页结束后仍有文本修正时继续等待', () => {
|
||||
assert.equal(shouldFinishAfterStop({ ...base, quietMs: 120 }), false);
|
||||
});
|
||||
|
||||
test('网页状态未回切时由超时兜底结束', () => {
|
||||
assert.equal(shouldFinishAfterStop({ ...base, elapsedMs: 4_500, isRecording: true }), true);
|
||||
});
|
||||
Reference in New Issue
Block a user