summaryrefslogtreecommitdiff
path: root/tests/giomm_asyncresult_sourceobject
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2010-01-28 10:08:51 +0100
committerMurray Cumming <murrayc@murrayc.com>2010-03-08 15:49:53 +0100
commit1af070ad51f63ebe34dec81b3d19b26b6464ebfd (patch)
tree5b9d94c6310b9f7061effd6c211787fa37c18b16 /tests/giomm_asyncresult_sourceobject
parentc579749fa8af27cb5b26d0c172148ac4ea575296 (diff)
downloadglibmm-1af070ad51f63ebe34dec81b3d19b26b6464ebfd.tar.gz
AsyncResult: Add get_source_object_base(), deprecating get_source_object().
* gio/asyncresult.[hg|ccg]: Deprecate get_source_object(), replacing it with get_source_object_base(), because in giomm, the C++ wrapper object might be a Glib::Interface, but not a Glib::Object (though the underlying C instance must be a GObject). This happens if giomm does not know about the GType of the underlying C Object, which is a legitimate situation. * tests/giomm_asyncresult_sourceobject/main.cc: Added this test case from Michael Hasselmann, from bug #608269.
Diffstat (limited to 'tests/giomm_asyncresult_sourceobject')
-rw-r--r--tests/giomm_asyncresult_sourceobject/main.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/giomm_asyncresult_sourceobject/main.cc b/tests/giomm_asyncresult_sourceobject/main.cc
new file mode 100644
index 00000000..1c9f1a15
--- /dev/null
+++ b/tests/giomm_asyncresult_sourceobject/main.cc
@@ -0,0 +1,30 @@
+#include <giomm.h>
+#include <iostream>
+
+void on_read_async(const Glib::RefPtr<Gio::AsyncResult>& result)
+{
+ std::cout << "Testing result ... "
+ << (result ? "OK!" : "FAILED!") << std::endl;
+
+ std::cout << "Testing get_source_object from gobj() ... "
+ << (g_async_result_get_source_object(result->gobj()) ? "OK!" : "FAILED!") << std::endl;
+
+ std::cout << "Testing Gio::AsyncResult's get_source_object ... "
+ << (result->get_source_object_base() ? "OK!" : "FAILED!") << std::endl;
+
+ exit(EXIT_SUCCESS);
+}
+
+int main(int, char**)
+{
+ Glib::init();
+ Gio::init();
+
+ Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create();
+
+ Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/etc/passwd");
+ file->read_async(&on_read_async);
+
+ mainloop->run();
+ return 0;
+}