[glibmm] Make giomm tests Run Under Windows



commit d95bc55673127e8b70bfe40e634d79cd5812793d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Sep 17 13:03:36 2014 +0800

    Make giomm tests Run Under Windows
    
    /etc/fstab is a *nix only file, which would not normally exist under
    Windows unless one is under Cygwin.  Use the path for the Wordpad
    application on Windows, which is a standard part of Windows; and use
    /etc/fstab otherwise.
    
        * tests/giomm_ioerror/main.cc:
        * tests/giomm_simple/main.cc: Test for c:/windows/write.exe
          (Wordpad application) on Windows, and use /etc/fstab otherwise.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736778
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736778

 tests/giomm_ioerror/main.cc |    8 +++++++-
 tests/giomm_simple/main.cc  |    8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/tests/giomm_ioerror/main.cc b/tests/giomm_ioerror/main.cc
index 0a44d33..ae51ec2 100644
--- a/tests/giomm_ioerror/main.cc
+++ b/tests/giomm_ioerror/main.cc
@@ -21,6 +21,12 @@ std::ostream& ostr = debug;
 #error Forgot to #undef GIOMM_SAVED_HOST_NOT_FOUND
 #endif
 
+#ifdef G_OS_WIN32
+#define TEST_FILE "c:/windows/write.exe"
+#else
+#define TEST_FILE "/etc/fstab"
+#endif
+
 int main(int, char**)
 {
   Glib::init();
@@ -28,7 +34,7 @@ int main(int, char**)
 
   try
   {
-    Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/etc/fstab");
+    Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(TEST_FILE);
     if(!file)
     {
       std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl;
diff --git a/tests/giomm_simple/main.cc b/tests/giomm_simple/main.cc
index 35f5cbf..e88c460 100644
--- a/tests/giomm_simple/main.cc
+++ b/tests/giomm_simple/main.cc
@@ -9,6 +9,12 @@
 std::stringstream debug;
 std::ostream& ostr = debug;
 
+#ifdef G_OS_WIN32
+#define TEST_FILE "c:/windows/write.exe"
+#else
+#define TEST_FILE "/etc/fstab"
+#endif
+
 int main(int, char**)
 {
   Glib::init();
@@ -16,7 +22,7 @@ int main(int, char**)
 
   try
   {
-    Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/etc/fstab");
+    Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(TEST_FILE);
     if(!file)
     {
       std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]