diff options
| author | Nat Goodspeed <nat@lindenlab.com> | 2009-12-03 10:38:26 -0500 | 
|---|---|---|
| committer | Nat Goodspeed <nat@lindenlab.com> | 2009-12-03 10:38:26 -0500 | 
| commit | 91dd8b2371d40d0e64898b041a71601a301ab8eb (patch) | |
| tree | 1f1db933ac6531a2c95bbabfa1dca22dfbe6d1df /indra/test | |
| parent | 67f11add9c2e05e1c86e30c44c94ee1b7d9205d0 (diff) | |
| parent | b626783d14db95ca167fc940230937ab2bcd054f (diff) | |
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/
Diffstat (limited to 'indra/test')
| -rw-r--r-- | indra/test/llevents_tut.cpp | 30 | 
1 files changed, 29 insertions, 1 deletions
| diff --git a/indra/test/llevents_tut.cpp b/indra/test/llevents_tut.cpp index 31130c3c79..e58b10ce07 100644 --- a/indra/test/llevents_tut.cpp +++ b/indra/test/llevents_tut.cpp @@ -21,6 +21,7 @@  #define testable public  #include "llevents.h"  #undef testable +#include "lllistenerwrapper.h"  // STL headers  // std headers  #include <iostream> @@ -639,6 +640,33 @@ namespace tut          heaptest.post(2);      } +    template<> template<> +    void events_object::test<15>() +    { +        // This test ensures that using an LLListenerWrapper subclass doesn't +        // block Boost.Signals2 from recognizing a bound LLEventTrackable +        // subclass. +        set_test_name("listen(llwrap<LLLogListener>(boost::bind(...TempTrackableListener ref...)))"); +        bool live = false; +        LLEventPump& heaptest(pumps.obtain("heaptest")); +        LLBoundListener connection; +        { +            TempTrackableListener tempListener("temp", live); +            ensure("TempTrackableListener constructed", live); +            connection = heaptest.listen(tempListener.getName(), +                                         llwrap<LLLogListener>( +                                         boost::bind(&TempTrackableListener::call, +                                                     boost::ref(tempListener), _1))); +            heaptest.post(1); +            check_listener("received", tempListener, 1); +        } // presumably this will make tempListener go away? +        // verify that +        ensure("TempTrackableListener destroyed", ! live); +        ensure("implicit disconnect", ! connection.connected()); +        // now just make sure we don't blow up trying to access a freed object! +        heaptest.post(2); +    } +      class TempSharedListener: public TempListener,                                public boost::enable_shared_from_this<TempSharedListener>      { @@ -649,7 +677,7 @@ namespace tut      };      template<> template<> -    void events_object::test<15>() +    void events_object::test<16>()      {          set_test_name("listen(boost::bind(...TempSharedListener ref...))");  #if 0 | 
