Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/modularships/test/util/output/MemoryWriterTest.cc @ 10034

Last change on this file since 10034 was 9545, checked in by landauf, 12 years ago

eol-style native

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1#include <gtest/gtest.h>
2#include <gmock/gmock.h>
3#include "util/Output.h"
4#include "util/output/MemoryWriter.h"
5#include "util/output/OutputManager.h"
6
7namespace orxonox
8{
9    namespace
10    {
11        class MockOutputListener : public OutputListener
12        {
13            public:
14                MOCK_METHOD3(output, void(OutputLevel, const OutputContextContainer&, const std::vector<std::string>&));
15        };
16    }
17
18    TEST(MemoryWriterTest, Disable)
19    {
20        EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size());
21        MemoryWriter writer;
22        EXPECT_EQ(1U, OutputManager::getInstance().getListeners().size());
23        writer.disable();
24        EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size());
25    }
26
27    TEST(MemoryWriterTest, ResendOutput)
28    {
29        MemoryWriter writer;
30
31        std::vector<std::string> lines;
32        lines.push_back("random line of output");
33        lines.push_back("another line of output");
34
35        writer.unfilteredOutput(level::user_info, context::undefined(), lines);
36        writer.unfilteredOutput(level::verbose, context::xml(), lines);
37
38        MockOutputListener other;
39        other.setLevelMask(level::all);
40
41        EXPECT_CALL(other, output(level::user_info, context::undefined(), lines));
42        EXPECT_CALL(other, output(level::verbose, context::xml(), lines));
43
44        writer.resendOutput(&other);
45    }
46}
Note: See TracBrowser for help on using the repository browser.