mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 00:52:08 +00:00 
			
		
		
		
	Add setScreenOrientation to BaseUiAutomation class
This allows workloads to be launched in a pre-determined orientation not the orientation of the physical device itself. Updated the productivity workloads to take advantage of this new facility.
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								wlauto/common/android/BaseUiAutomation$1.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								wlauto/common/android/BaseUiAutomation$1.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								wlauto/common/android/BaseUiAutomation$ScreenOrientation.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								wlauto/common/android/BaseUiAutomation$ScreenOrientation.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -35,6 +35,7 @@ import com.android.uiautomator.testrunner.UiAutomatorTestCase;
 | 
			
		||||
public class BaseUiAutomation extends UiAutomatorTestCase {
 | 
			
		||||
 | 
			
		||||
    public long waitTimeout = TimeUnit.SECONDS.toMillis(4);
 | 
			
		||||
    public enum ScreenOrientation { RIGHT, NATURAL, LEFT };
 | 
			
		||||
 | 
			
		||||
    public void sleep(int second) {
 | 
			
		||||
        super.sleep(second * 1000);
 | 
			
		||||
@@ -251,4 +252,24 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
 | 
			
		||||
 | 
			
		||||
        view.performTwoPointerGesture(startPoint1, startPoint2, endPoint1, endPoint2, steps);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setScreenOrientation(ScreenOrientation orientation) throws Exception {
 | 
			
		||||
        switch (orientation) {
 | 
			
		||||
            case RIGHT:
 | 
			
		||||
                getUiDevice().setOrientationRight();
 | 
			
		||||
                break;
 | 
			
		||||
            case NATURAL:
 | 
			
		||||
                getUiDevice().setOrientationNatural();
 | 
			
		||||
                break;
 | 
			
		||||
            case LEFT:
 | 
			
		||||
                getUiDevice().setOrientationLeft();
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                throw new Exception("No orientation specified");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void unsetScreenOrientation() throws Exception {
 | 
			
		||||
        getUiDevice().unfreezeRotation();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,8 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
    public void runUiAutomation() throws Exception {
 | 
			
		||||
        parameters = getParams();
 | 
			
		||||
 | 
			
		||||
        setScreenOrientation(ScreenOrientation.NATURAL);
 | 
			
		||||
 | 
			
		||||
        clearFirstRunDialogues();
 | 
			
		||||
 | 
			
		||||
        clickNewMail();
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -43,12 +43,14 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
    public void runUiAutomation() throws Exception {
 | 
			
		||||
        parameters = getParams();
 | 
			
		||||
 | 
			
		||||
        setScreenOrientation(ScreenOrientation.NATURAL);
 | 
			
		||||
        confirmAccess();
 | 
			
		||||
        dismissWelcomeView();
 | 
			
		||||
        gesturesTest();
 | 
			
		||||
        editPhotoColorTest();
 | 
			
		||||
        cropPhotoTest();
 | 
			
		||||
        rotatePhotoTest();
 | 
			
		||||
        unsetScreenOrientation();
 | 
			
		||||
 | 
			
		||||
        writeResultsToFile(timingResults, parameters.getString("output_file"));
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -44,17 +44,23 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
    public void runUiAutomation() throws Exception {
 | 
			
		||||
        parameters = getParams();
 | 
			
		||||
 | 
			
		||||
        dismissWelcomeView();
 | 
			
		||||
        setScreenOrientation(ScreenOrientation.NATURAL);
 | 
			
		||||
 | 
			
		||||
        dismissWelcomeView();
 | 
			
		||||
        signInOnline(parameters);
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
 | 
			
		||||
        confirmAccess();
 | 
			
		||||
 | 
			
		||||
=======
 | 
			
		||||
        confirmLocalFileAccess();
 | 
			
		||||
>>>>>>> 3991e73... Add setScreenOrientation to BaseUiAutomation class
 | 
			
		||||
        gesturesTest("Getting Started.pdf");
 | 
			
		||||
 | 
			
		||||
        String[] searchStrings = {"Glossary", "cortex"};
 | 
			
		||||
        searchPdfTest("cortex_m4", searchStrings);
 | 
			
		||||
 | 
			
		||||
        unsetScreenOrientation();
 | 
			
		||||
 | 
			
		||||
        writeResultsToFile(timingResults, parameters.getString("output_file"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,8 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
        outputDir = parameters.getString("output_dir", "/sdcard/wa-working");
 | 
			
		||||
        dumpsysEnabled = Boolean.parseBoolean(parameters.getString("dumpsys_enabled"));
 | 
			
		||||
 | 
			
		||||
        setScreenOrientation(ScreenOrientation.NATURAL);
 | 
			
		||||
 | 
			
		||||
        // Run tests
 | 
			
		||||
        handleLoginScreen(loginName, loginPass);
 | 
			
		||||
        confirmAccess();
 | 
			
		||||
@@ -72,6 +74,8 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
            voiceCallTest(callDuration);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        unsetScreenOrientation();
 | 
			
		||||
 | 
			
		||||
        // Save results
 | 
			
		||||
        writeResultsToFile(results, resultsFile);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user