| 1 |
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30") |
| 2 |
# is Boost available and new enough to ship its own config? |
| 3 |
cmake_policy(SET CMP0167 NEW) |
| 4 |
find_package(Boost CONFIG) |
| 5 |
|
| 6 |
# if not, fallback to CMake’s Boost config |
| 7 |
if(NOT Boost_FOUND) |
| 8 |
cmake_policy(SET CMP0167 OLD) |
| 9 |
find_package(Boost REQUIRED) |
| 10 |
endif() |
| 11 |
else() |
| 12 |
find_package(Boost REQUIRED) |
| 13 |
endif() |
| 14 |
|
| 15 |
find_package(Catch2 3 REQUIRED) |
| 16 |
find_package(RAPIDXML REQUIRED) |
| 17 |
find_package(SVGPP REQUIRED) |
| 18 |
|
| 19 |
enable_testing() |
| 20 |
|
| 21 |
add_library(test_common STATIC |
| 22 |
graphviz_edge.cpp |
| 23 |
graphviz_edge.h |
| 24 |
graphviz_graph.cpp |
| 25 |
graphviz_graph.h |
| 26 |
graphviz_node.h |
| 27 |
graphviz_node.cpp |
| 28 |
test_utilities.cpp |
| 29 |
svgpp_context.cpp |
| 30 |
svgpp_context.h |
| 31 |
svgpp_document_traverser.cpp |
| 32 |
svgpp_document_traverser.h |
| 33 |
svg_analyzer.cpp |
| 34 |
svg_analyzer.h |
| 35 |
svg_analyzer_interface.h |
| 36 |
svg_element.cpp |
| 37 |
svg_element.h |
| 38 |
test_edge_node_overlap_utilities.cpp |
| 39 |
test_edge_node_overlap_utilities.h |
| 40 |
../cmd/dot/dot_builtins.cpp |
| 41 |
) |
| 42 |
set_target_properties(test_common PROPERTIES CXX_STANDARD 20) |
| 43 |
set_target_properties(test_common PROPERTIES CXX_STANDARD_REQUIRED ON) |
| 44 |
target_include_directories(test_common PRIVATE |
| 45 |
../lib |
| 46 |
../lib/cgraph++ |
| 47 |
) |
| 48 |
target_include_directories(test_common SYSTEM PRIVATE |
| 49 |
${Boost_INCLUDE_DIRS} |
| 50 |
${RAPIDXML_INCLUDE_DIRS} |
| 51 |
${SVGPP_INCLUDE_DIRS} |
| 52 |
) |
| 53 |
target_link_libraries(test_common PUBLIC |
| 54 |
gvplugin_core |
| 55 |
gvplugin_dot_layout |
| 56 |
gvplugin_gd |
| 57 |
gvplugin_kitty |
| 58 |
gvplugin_neato_layout |
| 59 |
gvplugin_pango |
| 60 |
gvplugin_vt |
| 61 |
gvplugin_webp |
| 62 |
cgraph |
| 63 |
cgraph++ |
| 64 |
gvc |
| 65 |
gvc++ |
| 66 |
Catch2::Catch2 |
| 67 |
) |
| 68 |
|
| 69 |
# common steps for creating a test case |
| 70 |
macro(CREATE_TEST testname) |
| 71 |
add_executable(test_${testname} test_${testname}.cpp) |
| 72 |
set_target_properties(test_${testname} PROPERTIES CXX_STANDARD 20) |
| 73 |
set_target_properties(test_${testname} PROPERTIES CXX_STANDARD_REQUIRED ON) |
| 74 |
add_test(NAME test_${testname} |
| 75 |
COMMAND ./test_${testname} --reporter JUnit::out=test_${testname}.xml |
| 76 |
--reporter console::out=-::colour-mode=ansi) |
| 77 |
target_include_directories(test_${testname} PRIVATE |
| 78 |
../lib |
| 79 |
../lib/cdt |
| 80 |
../lib/cgraph |
| 81 |
../lib/cgraph++ |
| 82 |
../lib/common |
| 83 |
../lib/gvc |
| 84 |
../lib/pathplan |
| 85 |
) |
| 86 |
target_link_libraries(test_${testname} PRIVATE |
| 87 |
test_common |
| 88 |
) |
| 89 |
target_link_libraries(test_${testname} PRIVATE Catch2::Catch2WithMain) |
| 90 |
endmacro() |
| 91 |
|
| 92 |
CREATE_TEST(AGraph_construction) |
| 93 |
CREATE_TEST(clusters) |
| 94 |
CREATE_TEST(edge_color) |
| 95 |
CREATE_TEST(edge_fillcolor) |
| 96 |
CREATE_TEST(edge_penwidth) |
| 97 |
CREATE_TEST(engines) |
| 98 |
CREATE_TEST(GVContext_construction) |
| 99 |
CREATE_TEST(GVContext_render_svg) |
| 100 |
CREATE_TEST(GVLayout_construction) |
| 101 |
CREATE_TEST(GVLayout_render) |
| 102 |
CREATE_TEST(edge_node_overlap_all_edge_arrows) |
| 103 |
CREATE_TEST(edge_node_overlap_all_node_shapes) |
| 104 |
CREATE_TEST(edge_node_overlap_all_primitive_edge_arrows) |
| 105 |
CREATE_TEST(edge_node_overlap_box_edge_arrow) |
| 106 |
CREATE_TEST(edge_node_overlap_box_edge_arrow_various_arrowsizes) |
| 107 |
CREATE_TEST(edge_node_overlap_crow_and_vee_edge_arrows) |
| 108 |
CREATE_TEST(edge_node_overlap_curve_and_icurve_edge_arrows) |
| 109 |
CREATE_TEST(edge_node_overlap_cylinder_node_shape) |
| 110 |
CREATE_TEST(edge_node_overlap_diamond_edge_arrow) |
| 111 |
CREATE_TEST(edge_node_overlap_diamond_edge_arrow_various_arrowsizes) |
| 112 |
CREATE_TEST(edge_node_overlap_dot_edge_arrow) |
| 113 |
CREATE_TEST(edge_node_overlap_dot_edge_arrow_various_arrowsizes) |
| 114 |
CREATE_TEST(edge_node_overlap_ellipse_node_shapes_except_point) |
| 115 |
CREATE_TEST(edge_node_overlap_none_edge_arrow) |
| 116 |
CREATE_TEST(edge_node_overlap_none_edge_arrow_various_arrowsizes) |
| 117 |
CREATE_TEST(edge_node_overlap_normal_and_inv_edge_arrows) |
| 118 |
CREATE_TEST(edge_node_overlap_normal_and_inv_edge_arrows_all_modifiers) |
| 119 |
CREATE_TEST(edge_node_overlap_normal_and_inv_edge_arrows_various_arrowsizes) |
| 120 |
CREATE_TEST(edge_node_overlap_plain_node_shape) |
| 121 |
CREATE_TEST(edge_node_overlap_point_node_shape) |
| 122 |
CREATE_TEST(edge_node_overlap_polygon_node_shapes) |
| 123 |
CREATE_TEST(edge_node_overlap_record_node_shape) |
| 124 |
CREATE_TEST(edge_node_overlap_simple) |
| 125 |
CREATE_TEST(edge_node_overlap_tee_edge_arrow) |
| 126 |
CREATE_TEST(edge_node_overlap_tee_edge_arrow_various_arrowsizes) |
| 127 |
CREATE_TEST(max_edge_node_overlap_simple) |
| 128 |
CREATE_TEST(max_edge_node_overlap_polygon_node_shapes) |
| 129 |
CREATE_TEST(min_edge_node_overlap_polygon_node_shapes) |
| 130 |
CREATE_TEST(min_edge_node_overlap_simple) |
| 131 |
CREATE_TEST(max_edge_stem_arrow_overlap_simple) |
| 132 |
CREATE_TEST(min_edge_stem_arrow_overlap_simple) |
| 133 |
CREATE_TEST(neatopack) |
| 134 |
CREATE_TEST(node_color) |
| 135 |
CREATE_TEST(node_fillcolor) |
| 136 |
CREATE_TEST(node_penwidth) |
| 137 |
CREATE_TEST(rankdir) |
| 138 |
CREATE_TEST(simple) |
| 139 |
CREATE_TEST(subgraph_layout) |
| 140 |
CREATE_TEST(subgraphs) |
| 141 |
CREATE_TEST(svg_analyzer) |
| 142 |
CREATE_TEST(svg_analyzer_color) |
| 143 |
CREATE_TEST(svg_analyzer_fillcolor) |
| 144 |
CREATE_TEST(svg_analyzer_penwidth) |