external_display¶
Source code: external_display.py
Test external display with optional audio playback test.
Description¶
Verify the external display (HDMI, DP, USB to HDMI or USB to DP) is functional.
The test is defined by a list [display_label, display_id,
audio_info, usbpd_spec]
. Each item represents an external port:
display_label
: I18n display name. e.g._('DisplayPort)
or_('HDMI External Display')
or_('Type-C')
.display_id
: (str) ID used to identify target display path. e.g. DP-1, HDMI-A-1.audio_info
: A list of[audio_card, audio_device, init_actions]
, or None:audio_card
is either the card’s name (str), or the card’s index (int).audio_device
is the device’s index (int).init_actions
is a list of[card_name, action]
(list). action is a dict key defined in audio.json (ref: audio.py) to be passed into dut.audio.ApplyAudioConfig.
e.g.
[["rt5650", "init_audio"], ["rt5650", "enable_hdmi"]]
. This argument is optional. If set, the audio playback test is added.usbpd_spec
: An object of cros.factory.device.usb_c.USB_PD_SPEC_SCHEMA, or None.
It can also be configured to run automatically by specifying bft_fixture
argument, and skip some steps by setting connect_only
,
start_output_only
and stop_output_only
.
Test Procedure¶
This test can be manual or automated depends on whether bft_fixture
is specified. The test loops through all items in display_info
and:
Plug an external monitor to the port specified in dargs.
If
usbpd_spec
is specified ordisplay_label
isType-C
, verify usbpd status automatically.Main display will automatically switch to the external one.
Press the number or HW buttons shown on the display to verify display works.
(Optional) If
audio_info
is specified, the speaker will play a random number, and operator has to press the number to verify audio functionality.Unplug the external monitor to finish the test.
Dependency¶
display
component in device API.Optional
audio
andusb_c
components in device API.Optional fixture can be used to support automated test.
Examples¶
To manually check external display, add this in test list:
{
"pytest_name": "external_display",
"args": {
"display_info": [
{
"display_label": "i18n! HDMI External Display",
"display_id": "HDMI-A-1"
}
]
}
}
To manually check external display at USB Port 0 with CC1 or CC2, add this in test list:
{
"pytest_name": "external_display",
"args": {
"display_info": [
{
"display_label": "DisplayPort",
"display_id": "DP-1",
"usbpd_spec": 0
}
]
}
}
To manually check external display at USB Port 0 CC1, add this in test list:
{
"pytest_name": "external_display",
"args": {
"display_info": [
{
"display_label": "DisplayPort",
"display_id": "DP-1",
"usbpd_spec": {
"port": 0,
"polarity": 1
}
}
]
}
}
To manually check two external display USB ports and automatically detect display_id and usbpd_spec, add this in test list:
{
"pytest_name": "external_display",
"args": {
"display_info": [
{
"display_label": "Type-C"
},
{
"display_label": "Type-C"
}
]
}
}
For tablet or Chromebox, use HW buttons instead of keyboard numbers:
{
"args": {
"hw_buttons": [
["KEY_VOLUMEDOWN", "Volume Down"],
["KEY_VOLUMEUP", "Volume Up"],
["KEY_POWER", "Power Button"]
],
"device_filter": "cros_ec_buttons"
}
}
Test Arguments¶
Name |
Type |
Description |
---|---|---|
display_info |
list |
A list of tuples (display_label, display_id, audio_info, usbpd_spec) represents an external port to test. display_id and usbpd_spec can be detected automatically if display_label is in TYPE_FROM_LABEL. |
bft_fixture |
dict, None |
(optional; default:
The default value of |
connect_only |
bool |
(optional; default: |
start_output_only |
bool |
(optional; default: |
stop_output_only |
bool |
(optional; default: |
already_connect |
bool |
(optional; default: |
drm_sysfs_path |
str |
(optional; default: |
timeout_secs |
int |
(optional; default: |
hw_buttons |
list, None |
(optional; default: |
device_filter |
int, str, None |
(optional; default: |