Files
jiecheng-business/test/voice_helper/skyworth_empty_test.sh
freeboss b7b5518834 feat: dev-5.1 分支基线(v1.3.35 发版后代码 + 5.1 声道改造文档)
- 以 main(ccc65af) 为基线提交当前工作区代码
- 新增 5.1 声道改造文档两份
- .gitignore 补充 .vscode/、.screenshots/
2026-11-02 19:25:12 +08:00

53 lines
2.0 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# skyworth_empty_test.sh - 创维 videoList 空候选测试
# 投递 videoList 为空串的广播,验证 Adapter firstNonEmpty() 后走 dropped 分支
#
# 可选参数(通过环境变量控制,均为可选):
# SKYWORTH_SKIP_COMPONENT=1 省略 -n 参数(不显式指定 Receiver 组件)
# SKYWORTH_SKIP_SENDER=1 省略 -p 参数(不指定 sender 包名,Adapter 内部用白名单默认值兜底)
#
# 用法: skyworth_empty_test.sh [mode]
# mode: empty 只投一个空串候选(默认)
# multi 投 [空串, 真实片名],验证跳过空候选取首个非空
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/common.sh"
require_adb
check_skyworth_adapter_exists
MODE="${1:-empty}"
# 组装 -n 和 -p(按开关可选,与 send_skyworth_broadcast 保持一致)
n_arg=""
p_arg=""
if [ -z "${SKYWORTH_SKIP_COMPONENT}" ]; then
n_arg="-n '${SKYWORTH_RECEIVER_COMPONENT}' "
fi
if [ -z "${SKYWORTH_SKIP_SENDER}" ]; then
p_arg="-p '${DEFAULT_SKYWORTH_SENDER}' "
fi
print_header "创维 videoList 空候选测试(mode=${MODE})"
if [ "${MODE}" = "multi" ]; then
# JSON 数组多个候选,模拟创维识别返回多个结果且首个为空
log_info "投递 [\"\", \"镖人\"],预期跳过空候选、取 \"镖人\" 走正常链路"
${ADB} shell "am broadcast \
-a '${ACTION_SKYWORTH_VOD}' \
${n_arg}${p_arg}--es videoList '[\"\", \"镖人\"]' \
--include-stopped-packages" 2>&1 | sed 's/^/ [adb] /'
log_ok "预期进入 VideoDetailActivity 或 SearchActivity"
else
log_info "投递 [\"\"],预期 Adapter 判定 videoList empty 走 dropped"
${ADB} shell "am broadcast \
-a '${ACTION_SKYWORTH_VOD}' \
${n_arg}${p_arg}--es videoList '[\"\"]' \
--include-stopped-packages" 2>&1 | sed 's/^/ [adb] /'
log_ok "预期被丢弃,无任何页面跳转(logcat: dropped skyworth videoList empty)"
fi
log_warn "验证方法:adb logcat -v threadtime VoiceCommand:V '*:S' 过滤 dropped 日志"