Fix "always zoom to fit" feature
[pulseview.git] / test / CMakeLists.txt
1 ##
2 ## This file is part of the PulseView project.
3 ##
4 ## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 ## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
6 ##
7 ## This program is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ## GNU General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 ##
20
21 set(pulseview_TEST_SOURCES
22         ${PROJECT_SOURCE_DIR}/pv/devicemanager.cpp
23         ${PROJECT_SOURCE_DIR}/pv/session.cpp
24         ${PROJECT_SOURCE_DIR}/pv/storesession.cpp
25         ${PROJECT_SOURCE_DIR}/pv/util.cpp
26         ${PROJECT_SOURCE_DIR}/pv/binding/binding.cpp
27         ${PROJECT_SOURCE_DIR}/pv/binding/device.cpp
28         ${PROJECT_SOURCE_DIR}/pv/data/analog.cpp
29         ${PROJECT_SOURCE_DIR}/pv/data/analogsegment.cpp
30         ${PROJECT_SOURCE_DIR}/pv/data/logic.cpp
31         ${PROJECT_SOURCE_DIR}/pv/data/logicsegment.cpp
32         ${PROJECT_SOURCE_DIR}/pv/data/segment.cpp
33         ${PROJECT_SOURCE_DIR}/pv/data/signalbase.cpp
34         ${PROJECT_SOURCE_DIR}/pv/data/signaldata.cpp
35         ${PROJECT_SOURCE_DIR}/pv/devices/device.cpp
36         ${PROJECT_SOURCE_DIR}/pv/devices/file.cpp
37         ${PROJECT_SOURCE_DIR}/pv/devices/hardwaredevice.cpp
38         ${PROJECT_SOURCE_DIR}/pv/devices/inputfile.cpp
39         ${PROJECT_SOURCE_DIR}/pv/devices/sessionfile.cpp
40         ${PROJECT_SOURCE_DIR}/pv/prop/bool.cpp
41         ${PROJECT_SOURCE_DIR}/pv/prop/double.cpp
42         ${PROJECT_SOURCE_DIR}/pv/prop/enum.cpp
43         ${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
44         ${PROJECT_SOURCE_DIR}/pv/prop/property.cpp
45         ${PROJECT_SOURCE_DIR}/pv/prop/string.cpp
46         ${PROJECT_SOURCE_DIR}/pv/popups/channels.cpp
47         ${PROJECT_SOURCE_DIR}/pv/view/analogsignal.cpp
48         ${PROJECT_SOURCE_DIR}/pv/view/cursor.cpp
49         ${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
50         ${PROJECT_SOURCE_DIR}/pv/view/flag.cpp
51         ${PROJECT_SOURCE_DIR}/pv/view/header.cpp
52         ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.cpp
53         ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.cpp
54         ${PROJECT_SOURCE_DIR}/pv/view/rowitem.cpp
55         ${PROJECT_SOURCE_DIR}/pv/view/ruler.cpp
56         ${PROJECT_SOURCE_DIR}/pv/view/signal.cpp
57         ${PROJECT_SOURCE_DIR}/pv/view/signalscalehandle.cpp
58         ${PROJECT_SOURCE_DIR}/pv/view/timeitem.cpp
59         ${PROJECT_SOURCE_DIR}/pv/view/timemarker.cpp
60         ${PROJECT_SOURCE_DIR}/pv/view/trace.cpp
61         ${PROJECT_SOURCE_DIR}/pv/view/tracegroup.cpp
62         ${PROJECT_SOURCE_DIR}/pv/view/tracepalette.cpp
63         ${PROJECT_SOURCE_DIR}/pv/view/tracetreeitem.cpp
64         ${PROJECT_SOURCE_DIR}/pv/view/tracetreeitemowner.cpp
65         ${PROJECT_SOURCE_DIR}/pv/view/triggermarker.cpp
66         ${PROJECT_SOURCE_DIR}/pv/view/view.cpp
67         ${PROJECT_SOURCE_DIR}/pv/view/viewitem.cpp
68         ${PROJECT_SOURCE_DIR}/pv/view/viewitemowner.cpp
69         ${PROJECT_SOURCE_DIR}/pv/view/viewitempaintparams.cpp
70         ${PROJECT_SOURCE_DIR}/pv/view/viewport.cpp
71         ${PROJECT_SOURCE_DIR}/pv/view/viewwidget.cpp
72         ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.cpp
73         ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.cpp
74         ${PROJECT_SOURCE_DIR}/pv/widgets/popup.cpp
75         ${PROJECT_SOURCE_DIR}/pv/widgets/popuptoolbutton.cpp
76         ${PROJECT_SOURCE_DIR}/pv/widgets/sweeptimingwidget.cpp
77         ${PROJECT_SOURCE_DIR}/pv/widgets/timestampspinbox.cpp
78         ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.cpp
79         data/analogsegment.cpp
80         data/logicsegment.cpp
81         view/ruler.cpp
82         test.cpp
83         util.cpp
84 )
85
86 # This list includes only QObject derived class headers.
87 set(pulseview_TEST_HEADERS
88         ${PROJECT_SOURCE_DIR}/pv/session.hpp
89         ${PROJECT_SOURCE_DIR}/pv/storesession.hpp
90         ${PROJECT_SOURCE_DIR}/pv/binding/device.hpp
91         ${PROJECT_SOURCE_DIR}/pv/data/signalbase.hpp
92         ${PROJECT_SOURCE_DIR}/pv/devices/device.hpp
93         ${PROJECT_SOURCE_DIR}/pv/popups/channels.hpp
94         ${PROJECT_SOURCE_DIR}/pv/popups/deviceoptions.hpp
95         ${PROJECT_SOURCE_DIR}/pv/prop/bool.hpp
96         ${PROJECT_SOURCE_DIR}/pv/prop/double.hpp
97         ${PROJECT_SOURCE_DIR}/pv/prop/enum.hpp
98         ${PROJECT_SOURCE_DIR}/pv/prop/int.hpp
99         ${PROJECT_SOURCE_DIR}/pv/prop/property.hpp
100         ${PROJECT_SOURCE_DIR}/pv/prop/string.hpp
101         ${PROJECT_SOURCE_DIR}/pv/view/analogsignal.hpp
102         ${PROJECT_SOURCE_DIR}/pv/view/cursor.hpp
103         ${PROJECT_SOURCE_DIR}/pv/view/flag.hpp
104         ${PROJECT_SOURCE_DIR}/pv/view/header.hpp
105         ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.hpp
106         ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.hpp
107         ${PROJECT_SOURCE_DIR}/pv/view/rowitem.hpp
108         ${PROJECT_SOURCE_DIR}/pv/view/ruler.hpp
109         ${PROJECT_SOURCE_DIR}/pv/view/signal.hpp
110         ${PROJECT_SOURCE_DIR}/pv/view/signalscalehandle.hpp
111         ${PROJECT_SOURCE_DIR}/pv/view/timeitem.hpp
112         ${PROJECT_SOURCE_DIR}/pv/view/timemarker.hpp
113         ${PROJECT_SOURCE_DIR}/pv/view/trace.hpp
114         ${PROJECT_SOURCE_DIR}/pv/view/tracegroup.hpp
115         ${PROJECT_SOURCE_DIR}/pv/view/tracetreeitem.hpp
116         ${PROJECT_SOURCE_DIR}/pv/view/triggermarker.hpp
117         ${PROJECT_SOURCE_DIR}/pv/view/view.hpp
118         ${PROJECT_SOURCE_DIR}/pv/view/viewitem.hpp
119         ${PROJECT_SOURCE_DIR}/pv/view/viewport.hpp
120         ${PROJECT_SOURCE_DIR}/pv/view/viewwidget.hpp
121         ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.hpp
122         ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.hpp
123         ${PROJECT_SOURCE_DIR}/pv/widgets/popup.hpp
124         ${PROJECT_SOURCE_DIR}/pv/widgets/popuptoolbutton.hpp
125         ${PROJECT_SOURCE_DIR}/pv/widgets/sweeptimingwidget.hpp
126         ${PROJECT_SOURCE_DIR}/pv/widgets/timestampspinbox.hpp
127         ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.hpp
128 )
129
130 if(ENABLE_DECODE)
131         list(APPEND pulseview_TEST_SOURCES
132                 ${PROJECT_SOURCE_DIR}/pv/binding/decoder.cpp
133                 ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.cpp
134                 ${PROJECT_SOURCE_DIR}/pv/data/decode/annotation.cpp
135                 ${PROJECT_SOURCE_DIR}/pv/data/decode/decoder.cpp
136                 ${PROJECT_SOURCE_DIR}/pv/data/decode/row.cpp
137                 ${PROJECT_SOURCE_DIR}/pv/data/decode/rowdata.cpp
138                 ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
139                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.cpp
140                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.cpp
141                 data/decoderstack.cpp
142         )
143
144         list(APPEND pulseview_TEST_HEADERS
145                 ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.hpp
146                 ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.hpp
147                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.hpp
148                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.hpp
149         )
150 endif()
151
152 if(Qt5Core_FOUND)
153         qt5_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS})
154 else()
155         # Workaround for QTBUG-22829: -DBOOST_NEXT_PRIOR_HPP_INCLUDED.
156         # https://bugreports.qt.io/browse/QTBUG-22829
157         qt4_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS}
158                 OPTIONS -DBOOST_NEXT_PRIOR_HPP_INCLUDED)
159         include(${QT_USE_FILE})
160 endif()
161
162 # On MinGW we need to use static linking.
163 if(NOT WIN32)
164         add_definitions(-DBOOST_TEST_DYN_LINK)
165 endif()
166
167 add_executable(pulseview-test
168         ${pulseview_TEST_SOURCES}
169         ${pulseview_TEST_HEADERS_MOC}
170 )
171
172 target_link_libraries(pulseview-test ${PULSEVIEW_LINK_LIBS})
173