aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Hoa Dinh <dvh@google.com>2014-11-11 17:31:32 -0800
committerGravatar Hoa Dinh <dvh@google.com>2014-11-11 17:31:32 -0800
commitdab960778452211e15b4ea45c60b82973c468129 (patch)
tree7fd043d6422cd54c0ecc9a1ff429b8e4d545a185 /tests
parentdb59b2dae2cb60c0f5f0c2181228b59140e52c90 (diff)
build for GTK
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt17
-rw-r--r--tests/main.cpp43
2 files changed, 53 insertions, 7 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 289feb82..58bdcf70 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,14 +1,17 @@
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src/include)
+pkg_check_modules (GLIB2 glib-2.0)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src/include ${GLIB2_INCLUDE_DIRS})
link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../Externals/ctemplate-osx/lib
${CMAKE_CURRENT_SOURCE_DIR}/../Externals/uchardet-osx/lib
${CMAKE_CURRENT_SOURCE_DIR}/../Externals/libetpan-osx/lib
)
-find_library(FOUNDATIONFRAMEWORK NAMES Foundation)
-find_library(SECURITYFRAMEWORK NAMES Security)
-find_library(CORESERVICESFRAMEWORK NAMES CoreServices)
+#find_library(FOUNDATIONFRAMEWORK NAMES Foundation)
+#find_library(SECURITYFRAMEWORK NAMES Security)
+#find_library(CORESERVICESFRAMEWORK NAMES CoreServices)
+
+add_executable (tests main.cpp)
+target_link_libraries (tests MailCore z etpan xml2 uchardet sasl2 tidy ctemplate ssl crypto pthread icudata icui18n icuio icule iculx icutest icutu icuuc uuid ${GLIB2_LIBRARIES})
+
-add_executable (tests main.mm test-all.mm)
-target_link_libraries (tests MailCore z etpan xml2 uchardet sasl2 iconv tidy ctemplate ssl crypto
- ${FOUNDATIONFRAMEWORK} ${SECURITYFRAMEWORK} ${CORESERVICESFRAMEWORK})
diff --git a/tests/main.cpp b/tests/main.cpp
new file mode 100644
index 00000000..1b1a5773
--- /dev/null
+++ b/tests/main.cpp
@@ -0,0 +1,43 @@
+//
+// main.m
+// tests
+//
+// Created by DINH Viêt Hoà on 1/10/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include <MailCore/MailCore.h>
+#include <glib.h>
+
+using namespace mailcore;
+
+class MyCallback : public OperationCallback {
+ virtual void operationFinished(Operation * op) {
+ fprintf(stderr, "operation finished\n");
+ IMAPFetchFoldersOperation * folderOp = (IMAPFetchFoldersOperation *) op;
+ fprintf(stderr, "result %s", MCUTF8(folderOp->folders()));
+ }
+};
+
+int main(int argc, const char * argv[])
+{
+
+ GMainLoop * main_loop = g_main_loop_new (NULL, FALSE);
+
+ IMAPAsyncSession * session = new IMAPAsyncSession();
+ session->setHostname(MCSTR("imap.gmail.com"));
+ session->setPort(993);
+ session->setUsername(MCSTR("johndoe@gmail.com"));
+ session->setPassword(MCSTR("blah"));
+ session->setConnectionType(ConnectionTypeTLS);
+ MyCallback * callback = new MyCallback();
+ IMAPFetchFoldersOperation * op = session->fetchAllFoldersOperation();
+ op->setCallback(callback);
+ op->start();
+ fprintf(stderr, "started op\n");
+
+ g_main_loop_run(main_loop);
+
+ return 0;
+}
+