• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***************************************************************************
2  *
3  * Copyright 2012 BMW Car IT GmbH
4  * Copyright (C) 2016 Advanced Driver Information Technology Joint Venture GmbH
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *        http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ****************************************************************************/
20 
21 #include "wayland-client.h"
22 #include <ivi-application-client-protocol.h>
23 #include <vector>
24 
25 class TestBase
26 {
27 public:
28     struct iviSurface
29     {
30         ivi_surface* surface;
31         uint32_t surface_id;
32     };
33     TestBase();
34     virtual ~TestBase();
35     void SetWLCompositor(struct wl_compositor* wlCompositor);
36     void SetIviApp(struct ivi_application* iviApp);
37     void SetShm(struct wl_shm* wlShm);
38     void SetShmFormats(uint32_t format);
39 
40 protected:
41     std::vector<wl_surface *> wlSurfaces;
42     std::vector<iviSurface> iviSurfaces;
43     std::vector<wl_buffer *> wlBuffers;
44     wl_display*    wlDisplay;
45     ivi_application* iviApp;
46     wl_shm* wlShm;
47     uint32_t shmFormats;
48 
49 private:
50     wl_registry*   wlRegistry;
51     wl_compositor* wlCompositor;
52 };
53 
SetWLCompositor(struct wl_compositor * wl_compositor)54 inline void TestBase::SetWLCompositor(struct wl_compositor* wl_compositor)
55     { wlCompositor = wl_compositor; }
SetIviApp(struct ivi_application * ivi_application)56 inline void TestBase::SetIviApp(struct ivi_application* ivi_application)
57     { iviApp = ivi_application; }
SetShm(struct wl_shm * wl_shm)58 inline void TestBase::SetShm(struct wl_shm* wl_shm)
59     { wlShm = wl_shm; }
SetShmFormats(uint32_t format)60 inline void TestBase::SetShmFormats(uint32_t format)
61     { shmFormats |= format; }
62