perappdensity

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package perappdensity provides functions to assist with perappdensity tast tests.

Index

Constants

View Source
const (
	// Setprop is the path for setprop command.
	Setprop = "/system/bin/setprop"
	// Setting is the settings string for allowing density changes.
	Setting = "persist.sys.enable_application_zoom"
	// Apk is the name of the apk used in these tests.
	Apk = "ArcPerAppDensityTest.apk"
	// PackageName is the name of density application.
	PackageName = "org.chromium.arc.testapp.perappdensitytest"
	// ViewActivity is the name of view (main) activity.
	ViewActivity = ".ViewActivity"
	// UniformScaleFactor applies 1.25 scaling.
	UniformScaleFactor = 1.25
	// UniformScaleFactorSetting string.
	UniformScaleFactorSetting = "persist.sys.ui.uniform_app_scaling"
	// Enabled is the value to enable uniform scaling.
	Enabled = "1"
	// Disabled is the value to disable uniform scaling
	Disabled = "0"
)

Variables

This section is empty.

Functions

func ConfirmPixelCountInActivitySurface

func ConfirmPixelCountInActivitySurface(ctx context.Context, cr *chrome.Chrome, a *arc.ARC, clr color.Color, nonScaledPixelCount int, act *arc.Activity) error

ConfirmPixelCountInActivitySurface confirms that 1.25 scaling has been correctly applied by checking the number of clr pixels drawn.

func MeasureDisplayDensity

func MeasureDisplayDensity(ctx context.Context, a *arc.ARC) (float64, error)

MeasureDisplayDensity initializes the display and returns its physical density.

func RunTest

func RunTest(ctx context.Context, cr *chrome.Chrome, a *arc.ARC, packageName string, testSteps []Change, activity string, expectedInitialPixelCount float64) error

RunTest takes a slice of activity names and a slice of density changes and executes them.

func SetUpApk

func SetUpApk(ctx context.Context, a *arc.ARC, apk string) error

SetUpApk enables developer option for density changes, and installs the specified apk.

func StartActivityWithWindowState

func StartActivityWithWindowState(ctx context.Context, tconn *chrome.TestConn, a *arc.ARC, windowState arc.WindowState, activity string) (*arc.Activity, error)

StartActivityWithWindowState starts the view activity with the specified window state. It is the responsibility of the caller to close the activity.

func ToggleUniformScaleFactor

func ToggleUniformScaleFactor(ctx context.Context, a *arc.ARC, value string) error

ToggleUniformScaleFactor sets the uniformScaleFactor setting to be value.

Types

type Change

type Change struct {
	// The action that should be performed to the current density.
	Name string
	// The corresponding key sequence to perform the action.
	KeySequence string
	// The expected pixel count after performing the current action.
	BlackPixelCount float64
}

Change is a struct containing information to perform density changes.

func (*Change) Execute

func (dc *Change) Execute(ctx context.Context, cr *chrome.Chrome, a *arc.ARC, ew *input.KeyboardEventWriter) error

Execute executes the density change, specified by KeySequence and confirms that the density was changed by validating the size of the square on the screen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL