Home | History | Annotate | Download | only in runner
      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     public BatchRunConfiguration(String glConfig, String rotation, String surfaceType,
     34             boolean required) {
     35         mGlConfig = glConfig;
     36         mRotation = rotation;
     37         mSurfaceType = surfaceType;
     38         mRequired = required;
     39     }
     40 
     41     /**
     42      * Get string that uniquely identifies this config
     43      */
     44     public String getId() {
     45         return String.format("{glformat=%s,rotation=%s,surfacetype=%s,required=%b}",
     46                 mGlConfig, mRotation, mSurfaceType, mRequired);
     47     }
     48 
     49     /**
     50      * Get the GL config used in this configuration.
     51      */
     52     public String getGlConfig() {
     53         return mGlConfig;
     54     }
     55 
     56     /**
     57      * Get the screen rotation used in this configuration.
     58      */
     59     public String getRotation() {
     60         return mRotation;
     61     }
     62 
     63     /**
     64      * Get the surface type used in this configuration.
     65      */
     66     public String getSurfaceType() {
     67         return mSurfaceType;
     68     }
     69 
     70     /**
     71      * Is this configuration mandatory to support, if target API is supported?
     72      */
     73     public boolean isRequired() {
     74         return mRequired;
     75     }
     76 
     77     @Override
     78     public boolean equals(Object other) {
     79         if (other == null) {
     80             return false;
     81         } else if (!(other instanceof BatchRunConfiguration)) {
     82             return false;
     83         } else {
     84             return getId().equals(((BatchRunConfiguration)other).getId());
     85         }
     86     }
     87 
     88     @Override
     89     public int hashCode() {
     90         return getId().hashCode();
     91     }
     92 }
     93