From 20f22e56999d2b90ec2b7a77149748b0c9740dc1 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 3 May 2015 16:05:14 -0700 Subject: Added base unit test source utilizing Google Test and corresponding CMake support. (bzr r14100) --- test/unittest.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/unittest.cpp (limited to 'test/unittest.cpp') 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 + * + * 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 : -- cgit v1.2.3 From 3ea82abd61e068d826ff6b7b68a76cb18db5377c Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 3 May 2015 23:39:41 -0700 Subject: Initialized unit test with gtkmm/glib setup. (bzr r14104) --- test/unittest.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/unittest.cpp') diff --git a/test/unittest.cpp b/test/unittest.cpp index f95c67d9c..0ec8f0383 100644 --- a/test/unittest.cpp +++ b/test/unittest.cpp @@ -11,6 +11,11 @@ #include "gtest/gtest.h" +#include + +#include "inkgc/gc-core.h" +#include "inkscape.h" + namespace { // Ensure that a known positive test works @@ -25,6 +30,18 @@ TEST(PreTest, WorldIsSane) } // namespace int main(int argc, char **argv) { + + // setup general environment +#if !GLIB_CHECK_VERSION(2,36,0) + g_type_init(); +#endif + int tmpArgc = 1; + char const *tmp[] = {"foo", ""}; + char **tmpArgv = const_cast(tmp); + Gtk::Main(tmpArgc, tmpArgv); + + Inkscape::GC::init(); + ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } -- cgit v1.2.3