lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6060] Preserve file history


From: Greg Chicares
Subject: [lmi-commits] [6060] Preserve file history
Date: Fri, 12 Dec 2014 11:42:20 +0000

Revision: 6060
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6060
Author:   chicares
Date:     2014-12-12 11:42:19 +0000 (Fri, 12 Dec 2014)
Log Message:
-----------
Preserve file history

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/main_wx_test.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-12-10 21:16:10 UTC (rev 6059)
+++ lmi/trunk/ChangeLog 2014-12-12 11:42:19 UTC (rev 6060)
@@ -34804,3 +34804,14 @@
   wx_test_config_settings.cpp
 Correct a specification error.
 
+20141210T2116Z <address@hidden> [516]
+
+  wx_test_default_update.cpp
+Rectify test specification.
+
+20141212T1142Z <address@hidden> [516]
+
+  main_wx_test.cpp
+Preserve file history. See:
+  http://lists.nongnu.org/archive/html/lmi/2014-12/msg00047.html
+

Modified: lmi/trunk/main_wx_test.cpp
===================================================================
--- lmi/trunk/main_wx_test.cpp  2014-12-10 21:16:10 UTC (rev 6059)
+++ lmi/trunk/main_wx_test.cpp  2014-12-12 11:42:19 UTC (rev 6060)
@@ -27,6 +27,7 @@
 #endif
 
 #include "alert.hpp"
+#include "docmanager_ex.hpp"
 #include "force_linking.hpp"
 #include "handle_exceptions.hpp"        // stealth_exception
 #include "main_common.hpp"              // initialize_application()
@@ -522,6 +523,9 @@
     }
 
   protected:
+    // Override base class virtual method.
+    virtual DocManagerEx* CreateDocManager();
+
     // wxApp overrides.
     virtual bool OnInit                 ();
     virtual bool OnExceptionInMainLoop  ();
@@ -545,6 +549,36 @@
 IMPLEMENT_APP_NO_MAIN(SkeletonTest)
 IMPLEMENT_WX_THEME_SUPPORT
 
+DocManagerEx* SkeletonTest::CreateDocManager()
+{
+    // Custom document manager allowing to intercept the behaviour of the
+    // program for testing purposes.
+    //
+    // Currently it is used to prevent the files opened during testing from
+    // being saved.
+    class DocManagerTest : public DocManagerEx
+    {
+      public:
+        virtual void FileHistoryLoad(wxConfigBase const&)
+            {
+            // We could call the base class method here, but it doesn't seem
+            // useful to do it and doing nothing here makes it more symmetric
+            // with FileHistorySave().
+            }
+
+        virtual void FileHistorySave(wxConfigBase&)
+            {
+            // Do not save the history to persistent storage: we don't want the
+            // files opened during testing replace the files actually opened by
+            // the user interactively.
+            }
+    };
+
+    // As in the base class version, notice that we must not use 'new(wx)' here
+    // as this object is deleted by wxWidgets itself.
+    return new DocManagerTest;
+}
+
 bool SkeletonTest::OnInit()
 {
     // The test output should be reproducible, so disable the time




reply via email to

[Prev in Thread] Current Thread [Next in Thread]