xref: /aosp_15_r20/external/deqp/android/cts/runner/src/com/drawelements/deqp/runner/BatchRunConfiguration.java (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.drawelements.deqp.runner;
17 
18 /**
19  * Test configuration of dEPQ test instance execution.
20  */
21 public class BatchRunConfiguration {
22     public static final String ROTATION_UNSPECIFIED = "unspecified";
23     public static final String ROTATION_PORTRAIT = "0";
24     public static final String ROTATION_LANDSCAPE = "90";
25     public static final String ROTATION_REVERSE_PORTRAIT = "180";
26     public static final String ROTATION_REVERSE_LANDSCAPE = "270";
27 
28     private final String mGlConfig;
29     private final String mRotation;
30     private final String mSurfaceType;
31     private final boolean mRequired;
32 
33     // Added for sub-class KhronosCTSBatchRunConfiguration
BatchRunConfiguration()34     public BatchRunConfiguration() {
35         mGlConfig = "";
36         mRotation = "";
37         mSurfaceType = "";
38         mRequired = false;
39     }
40 
BatchRunConfiguration(String glConfig, String rotation, String surfaceType, boolean required)41     public BatchRunConfiguration(String glConfig, String rotation,
42                                  String surfaceType, boolean required) {
43         mGlConfig = glConfig;
44         mRotation = rotation;
45         mSurfaceType = surfaceType;
46         mRequired = required;
47     }
48 
49     /**
50      * Get string that uniquely identifies this config
51      */
getId()52     public String getId() {
53         return String.format(
54             "{glformat=%s,rotation=%s,surfacetype=%s,required=%b}", mGlConfig,
55             mRotation, mSurfaceType, mRequired);
56     }
57 
58     /**
59      * Get the GL config used in this configuration.
60      */
getGlConfig()61     public String getGlConfig() { return mGlConfig; }
62 
63     /**
64      * Get the screen rotation used in this configuration.
65      */
getRotation()66     public String getRotation() { return mRotation; }
67 
68     /**
69      * Get the surface type used in this configuration.
70      */
getSurfaceType()71     public String getSurfaceType() { return mSurfaceType; }
72 
73     /**
74      * Is this configuration mandatory to support, if target API is supported?
75      */
isRequired()76     public boolean isRequired() { return mRequired; }
77 
78     @Override
equals(Object other)79     public boolean equals(Object other) {
80         if (other == null) {
81             return false;
82         } else if (!(other instanceof BatchRunConfiguration)) {
83             return false;
84         } else {
85             return getId().equals(((BatchRunConfiguration)other).getId());
86         }
87     }
88 
89     @Override
hashCode()90     public int hashCode() {
91         return getId().hashCode();
92     }
93 }
94