Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16c9d6a9 authored by John Reck's avatar John Reck
Browse files

Refactor hwuitest

Yank animations out into their own files

Change-Id: Iea522ee032752019c07ff308c3a3993011054308
parent ce805b32
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ hwui_src_files := \
    utils/StringUtils.cpp \
    utils/TestWindowContext.cpp \
    utils/VectorDrawableUtils.cpp \
    utils/TestUtils.cpp \
    AmbientShadow.cpp \
    AnimationContext.cpp \
    Animator.cpp \
@@ -253,9 +254,11 @@ LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static

LOCAL_SRC_FILES += \
    tests/TestContext.cpp \
    tests/TreeContentAnimation.cpp \
    tests/TestSceneRunner.cpp \
    tests/main.cpp

LOCAL_SRC_FILES += $(call all-cpp-files-under, tests/scenes)

include $(BUILD_EXECUTABLE)

# ------------------------
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#include "DisplayListCanvas.h"
#endif
#include "microbench/MicroBench.h"
#include "unit_tests/TestUtils.h"
#include "utils/TestUtils.h"

using namespace android;
using namespace android::uirenderer;
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include "OpReorderer.h"
#include "RecordedOp.h"
#include "RecordingCanvas.h"
#include "unit_tests/TestUtils.h"
#include "utils/TestUtils.h"
#include "microbench/MicroBench.h"

#include <vector>
+9 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
#ifndef TESTS_BENCHMARK_H
#define TESTS_BENCHMARK_H

#include "TestScene.h"

#include <string>
#include <vector>

@@ -26,12 +28,17 @@ struct BenchmarkOptions {
    int count;
};

typedef void (*BenchmarkFunctor)(const BenchmarkOptions&);
typedef test::TestScene* (*CreateScene)(const BenchmarkOptions&);

template <class T>
test::TestScene* simpleCreateScene(const BenchmarkOptions&) {
    return new T();
}

struct BenchmarkInfo {
    std::string name;
    std::string description;
    BenchmarkFunctor functor;
    CreateScene createScene;
};

class Benchmark {
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef TESTS_TESTSCENE_H
#define TESTS_TESTSCENE_H

namespace android {
namespace uirenderer {
class RenderNode;

#if HWUI_NEW_OPS
class RecordingCanvas;
typedef RecordingCanvas TestCanvas;
#else
class DisplayListCanvas;
typedef DisplayListCanvas TestCanvas;
#endif

namespace test {

class TestScene {
public:
    virtual ~TestScene() {}
    virtual void createContent(int width, int height, TestCanvas& renderer) = 0;
    virtual void doFrame(int frameNr) = 0;
};

} // namespace test
} // namespace uirenderer
} // namespace android

#endif /* TESTS_TESTSCENE_H */
Loading