diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2015-05-03 23:05:14 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2015-05-03 23:05:14 +0000 |
| commit | 20f22e56999d2b90ec2b7a77149748b0c9740dc1 (patch) | |
| tree | 80f0acb3013030ef85b77527ad108262bf76fe59 /test | |
| parent | cmake: move Intl check to 'Files we include' section (diff) | |
| download | inkscape-20f22e56999d2b90ec2b7a77149748b0c9740dc1.tar.gz inkscape-20f22e56999d2b90ec2b7a77149748b0c9740dc1.zip | |
Added base unit test source utilizing Google Test and corresponding CMake support.
(bzr r14100)
Diffstat (limited to 'test')
| -rw-r--r-- | test/CMakeLists.txt | 474 | ||||
| -rw-r--r-- | test/unittest.cpp | 41 |
2 files changed, 515 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000..09201ba4a --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,474 @@ +# ----------------------------------------------------------------------------- +# +# ----------------------------------------------------------------------------- + +set(CMAKE_CTEST_COMMAND ctest -V) + +add_subdirectory(${GMOCK_DIR} ${CMAKE_BINARY_DIR}/gmock) + +include_directories(SYSTEM ${GMOCK_DIR}/gtest/include + ${GMOCK_DIR}/include) + +# copied from ../src/CMakeLists.txt +# TODO resolve to shared definition +set(sp_SRC + ../src/attribute-rel-css.cpp + ../src/attribute-rel-svg.cpp + ../src/attribute-rel-util.cpp + ../src/sp-anchor.cpp + ../src/sp-clippath.cpp + ../src/sp-conn-end-pair.cpp + ../src/sp-conn-end.cpp + ../src/sp-cursor.cpp + ../src/sp-defs.cpp + ../src/sp-desc.cpp + ../src/sp-ellipse.cpp + ../src/sp-factory.cpp + ../src/sp-filter-primitive.cpp + ../src/sp-filter-reference.cpp + ../src/sp-filter.cpp + ../src/sp-flowdiv.cpp + ../src/sp-flowregion.cpp + ../src/sp-flowtext.cpp + ../src/sp-font-face.cpp + ../src/sp-font.cpp + ../src/sp-glyph-kerning.cpp + ../src/sp-glyph.cpp + ../src/sp-gradient-reference.cpp + ../src/sp-gradient.cpp + ../src/sp-guide.cpp + ../src/sp-hatch-path.cpp + ../src/sp-hatch.cpp + ../src/sp-image.cpp + ../src/sp-item-group.cpp + ../src/sp-item-notify-moveto.cpp + ../src/sp-item-rm-unsatisfied-cns.cpp + ../src/sp-item-transform.cpp + ../src/sp-item-update-cns.cpp + ../src/sp-item.cpp + ../src/sp-line.cpp + ../src/sp-linear-gradient.cpp + ../src/sp-lpe-item.cpp + ../src/sp-marker.cpp + ../src/sp-mask.cpp + ../src/sp-mesh-array.cpp + ../src/sp-mesh-patch.cpp + ../src/sp-mesh-row.cpp + ../src/sp-mesh.cpp + ../src/sp-metadata.cpp + ../src/sp-missing-glyph.cpp + ../src/sp-namedview.cpp + ../src/sp-object-group.cpp + ../src/sp-object.cpp + ../src/sp-offset.cpp + ../src/sp-paint-server.cpp + ../src/sp-path.cpp + ../src/sp-pattern.cpp + ../src/sp-polygon.cpp + ../src/sp-polyline.cpp + ../src/sp-radial-gradient.cpp + ../src/sp-rect.cpp + ../src/sp-root.cpp + ../src/sp-script.cpp + ../src/sp-shape.cpp + ../src/sp-solid-color.cpp + ../src/sp-spiral.cpp + ../src/sp-star.cpp + ../src/sp-stop.cpp + ../src/sp-string.cpp + ../src/sp-style-elem.cpp + ../src/sp-switch.cpp + ../src/sp-symbol.cpp + ../src/sp-tag-use-reference.cpp + ../src/sp-tag-use.cpp + ../src/sp-tag.cpp + ../src/sp-text.cpp + ../src/sp-title.cpp + ../src/sp-tref-reference.cpp + ../src/sp-tref.cpp + ../src/sp-tspan.cpp + ../src/sp-use-reference.cpp + ../src/sp-use.cpp + ../src/splivarot.cpp + ../src/viewbox.cpp + + # ------- + # Headers + ../src/attribute-rel-css.h + ../src/attribute-rel-svg.h + ../src/attribute-rel-util.h + ../src/sp-anchor.h + ../src/sp-clippath.h + ../src/sp-conn-end-pair.h + ../src/sp-conn-end.h + ../src/sp-cursor.h + ../src/sp-defs.h + ../src/sp-desc.h + ../src/sp-ellipse.h + ../src/sp-factory.h + ../src/sp-filter-primitive.h + ../src/sp-filter-reference.h + ../src/sp-filter-units.h + ../src/sp-filter.h + ../src/sp-flowdiv.h + ../src/sp-flowregion.h + ../src/sp-flowtext.h + ../src/sp-font-face.h + ../src/sp-font.h + ../src/sp-glyph-kerning.h + ../src/sp-glyph.h + ../src/sp-gradient-reference.h + ../src/sp-gradient-spread.h + ../src/sp-gradient-test.h + ../src/sp-gradient-units.h + ../src/sp-gradient-vector.h + ../src/sp-gradient.h + ../src/sp-guide-attachment.h + ../src/sp-guide-constraint.h + ../src/sp-guide.h + ../src/sp-hatch-path.h + ../src/sp-hatch.h + ../src/sp-image.h + ../src/sp-item-group.h + ../src/sp-item-notify-moveto.h + ../src/sp-item-rm-unsatisfied-cns.h + ../src/sp-item-transform.h + ../src/sp-item-update-cns.h + ../src/sp-item.h + ../src/sp-line.h + ../src/sp-linear-gradient.h + ../src/sp-lpe-item.h + ../src/sp-marker-loc.h + ../src/sp-marker.h + ../src/sp-mask.h + ../src/sp-mesh-array.h + ../src/sp-mesh-patch.h + ../src/sp-mesh-row.h + ../src/sp-mesh.h + ../src/sp-metadata.h + ../src/sp-missing-glyph.h + ../src/sp-namedview.h + ../src/sp-object-group.h + ../src/sp-object.h + ../src/sp-offset.h + ../src/sp-paint-server-reference.h + ../src/sp-paint-server.h + ../src/sp-path.h + ../src/sp-pattern.h + ../src/sp-polygon.h + ../src/sp-polyline.h + ../src/sp-radial-gradient.h + ../src/sp-rect.h + ../src/sp-root.h + ../src/sp-script.h + ../src/sp-shape.h + ../src/sp-solid-color.h + ../src/sp-spiral.h + ../src/sp-star.h + ../src/sp-stop.h + ../src/sp-string.h + ../src/sp-style-elem-test.h + ../src/sp-style-elem.h + ../src/sp-switch.h + ../src/sp-symbol.h + ../src/sp-text.h + ../src/sp-textpath.h + ../src/sp-title.h + ../src/sp-tref-reference.h + ../src/sp-tref.h + ../src/sp-tspan.h + ../src/sp-use-reference.h + ../src/sp-use.h + ../src/viewbox.h +) + +# copied from ../src/CMakeLists.txt +# TODO resolve to shared definition +set(inkscape_SRC + ../src/attributes.cpp + ../src/axis-manip.cpp + ../src/box3d-side.cpp + ../src/box3d.cpp + ../src/color-profile.cpp + ../src/color.cpp + ../src/composite-undo-stack-observer.cpp + ../src/conditions.cpp + ../src/conn-avoid-ref.cpp + ../src/console-output-undo-observer.cpp + ../src/context-fns.cpp + ../src/desktop-events.cpp + ../src/desktop-style.cpp + ../src/desktop.cpp + ../src/device-manager.cpp + ../src/dir-util.cpp + ../src/document-subset.cpp + ../src/document-undo.cpp + ../src/document.cpp + ../src/ege-color-prof-tracker.cpp + ../src/event-log.cpp + ../src/extract-uri.cpp + ../src/file.cpp + ../src/filter-chemistry.cpp + ../src/filter-enums.cpp + ../src/gc-anchored.cpp + ../src/gc-finalized.cpp + ../src/gradient-chemistry.cpp + ../src/gradient-drag.cpp + ../src/graphlayout.cpp + ../src/guide-snapper.cpp + ../src/help.cpp + ../src/id-clash.cpp + ../src/inkscape.cpp + ../src/knot-holder-entity.cpp + ../src/knot-ptr.cpp + ../src/knot.cpp + ../src/knotholder.cpp + ../src/layer-fns.cpp + ../src/layer-manager.cpp + ../src/layer-model.cpp + ../src/line-geometry.cpp + ../src/line-snapper.cpp + ../src/main-cmdlineact.cpp + ../src/media.cpp + ../src/message-context.cpp + ../src/message-stack.cpp + ../src/mod360.cpp + ../src/object-hierarchy.cpp + ../src/object-snapper.cpp + ../src/path-chemistry.cpp + ../src/persp3d-reference.cpp + ../src/persp3d.cpp + ../src/perspective-line.cpp + ../src/preferences.cpp + ../src/prefix.cpp + ../src/print.cpp + ../src/profile-manager.cpp + ../src/proj_pt.cpp + ../src/rdf.cpp + ../src/removeoverlap.cpp + ../src/resource-manager.cpp + ../src/rubberband.cpp + ../src/satisfied-guide-cns.cpp + ../src/selcue.cpp + ../src/selection-chemistry.cpp + ../src/selection-describer.cpp + ../src/selection.cpp + ../src/seltrans-handles.cpp + ../src/seltrans.cpp + ../src/shortcuts.cpp + ../src/snap-preferences.cpp + ../src/snap.cpp + ../src/snapped-curve.cpp + ../src/snapped-line.cpp + ../src/snapped-point.cpp + ../src/snapper.cpp + ../src/style-internal.cpp + ../src/style.cpp + ../src/svg-view-widget.cpp + ../src/svg-view.cpp + ../src/text-chemistry.cpp + ../src/text-editing.cpp + ../src/transf_mat_3x4.cpp + ../src/unclump.cpp + ../src/unicoderange.cpp + ../src/uri-references.cpp + ../src/uri.cpp + ../src/vanishing-point.cpp + ../src/verbs.cpp + ../src/version.cpp + + # ------- + # Headers + ../src/MultiPrinter.h + ../src/PylogFormatter.h + ../src/TRPIFormatter.h + ../src/attributes-test.h + ../src/attributes.h + ../src/axis-manip.h + ../src/bad-uri-exception.h + ../src/box3d-side.h + ../src/box3d.h + ../src/cms-color-types.h + ../src/cms-system.h + ../src/color-profile-cms-fns.h + ../src/color-profile-test.h + ../src/color-profile.h + ../src/color-rgba.h + ../src/color.h + ../src/colorspace.h + ../src/composite-undo-stack-observer.h + ../src/conditions.h + ../src/conn-avoid-ref.h + ../src/console-output-undo-observer.h + ../src/context-fns.h + ../src/decimal-round.h + ../src/desktop-events.h + ../src/desktop-style.h + ../src/desktop.h + ../src/device-manager.h + ../src/dir-util-test.h + ../src/dir-util.h + ../src/document-private.h + ../src/document-subset.h + ../src/document-undo.h + ../src/document.h + ../src/ege-color-prof-tracker.h + ../src/enums.h + ../src/event-log.h + ../src/event.h + ../src/extract-uri-test.h + ../src/extract-uri.h + ../src/file.h + ../src/fill-or-stroke.h + ../src/filter-chemistry.h + ../src/filter-enums.h + ../src/gc-anchored.h + ../src/gc-finalized.h + ../src/gradient-chemistry.h + ../src/gradient-drag.h + ../src/graphlayout.h + ../src/guide-snapper.h + ../src/help.h + ../src/helper-fns.h + ../src/icon-size.h + ../src/id-clash.h + ../src/inkscape-version.h + ../src/inkscape.h + ../src/isinf.h + ../src/knot-enums.h + ../src/knot-holder-entity.h + ../src/knot-ptr.h + ../src/knot.h + ../src/knotholder.h + ../src/layer-fns.h + ../src/layer-manager.h + ../src/layer-model.h + ../src/line-geometry.h + ../src/line-snapper.h + ../src/macros.h + ../src/main-cmdlineact.h + ../src/marker-test.h + ../src/media.h + ../src/menus-skeleton.h + ../src/message-context.h + ../src/message-stack.h + ../src/message.h + ../src/mod360-test.h + ../src/mod360.h + ../src/number-opt-number.h + ../src/object-hierarchy.h + ../src/object-snapper.h + ../src/object-test.h + ../src/path-chemistry.h + ../src/path-prefix.h + ../src/persp3d-reference.h + ../src/persp3d.h + ../src/perspective-line.h + ../src/preferences-skeleton.h + ../src/preferences-test.h + ../src/preferences.h + ../src/prefix.h + ../src/print.h + ../src/profile-manager.h + ../src/proj_pt.h + ../src/rdf.h + ../src/remove-last.h + ../src/removeoverlap.h + ../src/require-config.h + ../src/resource-manager.h + ../src/round-test.h + ../src/round.h + ../src/rubberband.h + ../src/satisfied-guide-cns.h + ../src/selcue.h + ../src/selection-chemistry.h + ../src/selection-describer.h + ../src/selection.h + ../src/seltrans-handles.h + ../src/seltrans.h + ../src/shortcuts.h + ../src/snap-candidate.h + ../src/snap-enums.h + ../src/snap-preferences.h + ../src/snap.h + ../src/snapped-curve.h + ../src/snapped-line.h + ../src/snapped-point.h + ../src/snapper.h + ../src/splivarot.h + ../src/streq.h + ../src/strneq.h + ../src/style-enums.h + ../src/style-internal.h + ../src/style-test.h + ../src/style.h + ../src/svg-profile.h + ../src/svg-view-widget.h + ../src/svg-view.h + ../src/syseq.h + ../src/test-helpers.h + ../src/text-chemistry.h + ../src/text-editing.h + ../src/text-tag-attributes.h + ../src/transf_mat_3x4.h + ../src/unclump.h + ../src/undo-stack-observer.h + ../src/unicoderange.h + ../src/uri-references.h + ../src/uri-test.h + ../src/uri.h + ../src/vanishing-point.h + ../src/verbs-test.h + ../src/verbs.h + ../src/version.h +) + +get_property(inkscape_global_SRC GLOBAL PROPERTY inkscape_global_SRC) + +set_source_files_properties( + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp + PROPERTIES GENERATED TRUE) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/__/src) + +add_executable(unittest + unittest.cpp + ${inkscape_SRC} + ${sp_SRC} + ${inkscape_global_SRC} + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp +) + +add_dependencies(unittest inkscape_version) + +target_link_libraries(unittest + gmock_main + + # order from automake + #sp_LIB + nrtype_LIB + + #inkscape_LIB + #sp_LIB # annoying, we need both! + nrtype_LIB # annoying, we need both! + + croco_LIB + avoid_LIB + gdl_LIB + cola_LIB + vpsc_LIB + livarot_LIB + uemf_LIB + 2geom_LIB + depixelize_LIB + util_LIB + gc_LIB + + ${INKSCAPE_LIBS} +) + +add_test(BaseTest ${EXECUTABLE_OUTPUT_PATH}/unittest) + +add_dependencies(check unittest) + +# diff --git a/test/unittest.cpp b/test/unittest.cpp new file mode 100644 index 000000000..f95c67d9c --- /dev/null +++ b/test/unittest.cpp @@ -0,0 +1,41 @@ +/* + * Unit test main. + * + * Author: + * Jon A. Cruz <jon@joncruz.org> + * + * Copyright (C) 2015 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "gtest/gtest.h" + +namespace { + +// Ensure that a known positive test works +TEST(PreTest, WorldIsSane) +{ + EXPECT_EQ(4, 2 + 2); +} + +// Example of type casting to avoid compile warnings. + + +} // namespace + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |
