diff options
author | Daniel_Burrows@alumni.brown.edu <Daniel_Burrows@alumni.brown.edu> | 2010-07-08 09:43:26 -0700 |
---|---|---|
committer | Daniel Burrows <dburrows@debian.org> | 2010-07-10 10:27:33 -0700 |
commit | 999360e26876e4e15734735c2826748ce830ba37 (patch) | |
tree | 67fba895b366f5330b2b6cfed0ce5bad07ade099 /tests | |
parent | d6c98d5670bddada3158daa81208f2a847b79361 (diff) | |
download | aptitude-999360e26876e4e15734735c2826748ce830ba37.tar.gz |
Split the "terminal" interface into several interfaces that each export one piece of its functionality.
This will make some of the tests easier to write, since often some of
the code requires just the ability to read the screen width, or just the
ability to read input from the terminal. Splitting the terminal interface
means no need to mock out the parts that aren't used.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cmdline_download_progress_display.cc | 41 | ||||
-rw-r--r-- | tests/test_teletype_mock.cc | 127 | ||||
-rw-r--r-- | tests/test_terminal_mock.cc | 63 | ||||
-rw-r--r-- | tests/test_transient_message.cc | 47 |
4 files changed, 99 insertions, 179 deletions
diff --git a/tests/test_cmdline_download_progress_display.cc b/tests/test_cmdline_download_progress_display.cc index 06b6c9e1..e4f6a190 100644 --- a/tests/test_cmdline_download_progress_display.cc +++ b/tests/test_cmdline_download_progress_display.cc @@ -49,52 +49,27 @@ namespace struct CmdlineDownloadProgressDisplayTest : public Test { shared_ptr<mocks::transient_message> msg; - shared_ptr<mocks::terminal> term; shared_ptr<mocks::terminal_locale> term_locale; + shared_ptr<mocks::terminal_metrics> term_metrics; shared_ptr<download_progress> progress; CmdlineDownloadProgressDisplayTest() : msg(make_shared<mocks::transient_message>()), - term(mocks::terminal::create()), term_locale(mocks::terminal_locale::create()), - progress(create_download_progress_display(msg, term, term_locale)) + term_metrics(mocks::terminal_metrics::create()), + progress(create_download_progress_display(msg, term_locale, term_metrics)) { - // Expect no occurrences of the terminal routines other than - // get_screen_width() (normally they would be invoked by the - // message, but that's a mock in this case). - - // TODO: is there a way to ask the mock to always reject - // unexpected calls? - EXPECT_CALL(*term, output_is_a_terminal()) - .Times(0); - - EXPECT_CALL(*term, write_text(_)) - .Times(0); - - EXPECT_CALL(*term, move_to_beginning_of_line()) - .Times(0); - - EXPECT_CALL(*term, flush()) - .Times(0); - - EXPECT_CALL(*term, prompt_for_input(_)) - .Times(0); - - EXPECT_CALL(*term, output(_)) - .Times(0); + // Set up the locale to claim that the two-column character + // occupies two columns. + EXPECT_CALL(*term_locale, wcwidth(two_column_char)) + .WillRepeatedly(Return(2)); // Make the terminal 20 characters wide by default (the progress // display always outputs messages that are as wide as the // terminal, so too wide a value would be a pain). - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(80)); - - - // Set up the locale to claim that the two-column character - // occupies two columns. - EXPECT_CALL(*term_locale, wcwidth(two_column_char)) - .WillRepeatedly(Return(2)); } }; } diff --git a/tests/test_teletype_mock.cc b/tests/test_teletype_mock.cc index f28c1cfc..41d1eb39 100644 --- a/tests/test_teletype_mock.cc +++ b/tests/test_teletype_mock.cc @@ -65,8 +65,9 @@ namespace // value of CTYPE. std::string previous_lc_ctype; - shared_ptr<mocks::terminal> term; shared_ptr<mocks::terminal_locale> term_locale; + shared_ptr<mocks::terminal_metrics> term_metrics; + shared_ptr<mocks::terminal_with_combined_output> term_output; shared_ptr<mocks::teletype> teletype; static std::string safe_string(const char *c) @@ -93,15 +94,16 @@ namespace TeletypeTest() : widechar(1, two_column_char), - term(mocks::terminal::create()), term_locale(mocks::terminal_locale::create()), - teletype(mocks::create_teletype(term, term_locale)) + term_metrics(mocks::terminal_metrics::create()), + term_output(mocks::terminal_with_combined_output::create()), + teletype(mocks::create_teletype(term_locale, term_metrics, term_output)) { - EXPECT_CALL(*term, get_screen_width()) - .WillRepeatedly(Return(80)); - EXPECT_CALL(*term_locale, wcwidth(two_column_char)) .WillRepeatedly(Return(2)); + + EXPECT_CALL(*term_metrics, get_screen_width()) + .WillRepeatedly(Return(80)); } void SetUp() @@ -121,7 +123,7 @@ TEST_F(TeletypeTest, testOutputPartialLine) { EXPECT_CALL(*teletype, set_last_line(StrEq(L"abc"))); - term->output(L"abc"); + term_output->output(L"abc"); } TEST_F(TeletypeTest, testOutputLine) @@ -134,8 +136,7 @@ TEST_F(TeletypeTest, testOutputLine) } - term->output(L"abc\n"); - term->flush(); + term_output->output(L"abc\n"); } TEST_F(TeletypeTest, NewlineAfterFlush) @@ -147,17 +148,17 @@ TEST_F(TeletypeTest, NewlineAfterFlush) EXPECT_CALL(*teletype, newline()); } - term->output(L"abc"); - term->output(L"\n"); + term_output->output(L"abc"); + term_output->output(L"\n"); } TEST_F(TeletypeTest, SuppressDuplicateWrites) { EXPECT_CALL(*teletype, set_last_line(StrEq(L"abc"))); - term->output(L"abc"); - term->move_to_beginning_of_line(); - term->output(L"abc"); + term_output->output(L"abc"); + term_output->output(L"\r"); + term_output->output(L"abc"); } // Imitates what the transient message does, to be sure that it will @@ -171,10 +172,8 @@ TEST_F(TeletypeTest, OverwriteABCWithA) EXPECT_CALL(*teletype, set_last_line(StrEq(L"a "))); } - term->output(L"abc"); - term->flush(); - term->output(L"\r \ra"); - term->flush(); + term_output->output(L"abc"); + term_output->output(L"\r \ra"); } TEST_F(TeletypeTest, testOverwriteOneCharAtATime) @@ -188,17 +187,10 @@ TEST_F(TeletypeTest, testOverwriteOneCharAtATime) EXPECT_CALL(*teletype, set_last_line(StrEq(L"xyz"))); } - term->output(L"abc\r"); - term->flush(); - - term->output(L"x"); - term->flush(); - - term->output(L"y"); - term->flush(); - - term->output(L"z"); - term->flush(); + term_output->output(L"abc\r"); + term_output->output(L"x"); + term_output->output(L"y"); + term_output->output(L"z"); } TEST_F(TeletypeTest, OverwriteNarrowCharWithWideChar) @@ -209,11 +201,8 @@ TEST_F(TeletypeTest, OverwriteNarrowCharWithWideChar) EXPECT_CALL(*teletype, set_last_line(StrEq(widechar + L"c"))); } - term->output(L"abc\r"); - term->flush(); - - term->output(widechar); - term->flush(); + term_output->output(L"abc\r"); + term_output->output(widechar); } TEST_F(TeletypeTest, OverwriteWideCharWithNarrowChar) @@ -230,11 +219,8 @@ TEST_F(TeletypeTest, OverwriteWideCharWithNarrowChar) EXPECT_CALL(*teletype, set_last_line(StrEq(L"a c"))); } - term->output(widechar + L"c\r"); - term->flush(); - - term->output(L"a"); - term->flush(); + term_output->output(widechar + L"c\r"); + term_output->output(L"a"); } TEST_F(TeletypeTest, OverwriteWideCharWithNarrowChars) @@ -245,11 +231,8 @@ TEST_F(TeletypeTest, OverwriteWideCharWithNarrowChars) EXPECT_CALL(*teletype, set_last_line(StrEq(L"abc"))); } - term->output(widechar + L"c\r"); - term->flush(); - - term->output(L"ab"); - term->flush(); + term_output->output(widechar + L"c\r"); + term_output->output(L"ab"); } TEST_F(TeletypeTest, overwriteEverything) @@ -261,10 +244,8 @@ TEST_F(TeletypeTest, overwriteEverything) EXPECT_CALL(*teletype, set_last_line(StrEq(L"xyz"))); } - term->output(L"abc\r"); - term->flush(); - term->output(L"xyz"); - term->flush(); + term_output->output(L"abc\r"); + term_output->output(L"xyz"); } TEST_F(TeletypeTest, overwritePastEverything) @@ -276,15 +257,13 @@ TEST_F(TeletypeTest, overwritePastEverything) EXPECT_CALL(*teletype, set_last_line(StrEq(L"xyzw"))); } - term->output(L"abc\r"); - term->flush(); - term->output(L"xyzw"); - term->flush(); + term_output->output(L"abc\r"); + term_output->output(L"xyzw"); } TEST_F(TeletypeTest, testWritePastEOL) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(5)); { @@ -295,12 +274,12 @@ TEST_F(TeletypeTest, testWritePastEOL) EXPECT_CALL(*teletype, set_last_line(StrEq(L"fghij"))); } - term->output(L"abcdefghij"); + term_output->output(L"abcdefghij"); } TEST_F(TeletypeTest, WritePastEOLAfterWideChar) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); { @@ -311,12 +290,12 @@ TEST_F(TeletypeTest, WritePastEOLAfterWideChar) EXPECT_CALL(*teletype, set_last_line(StrEq(L"def"))); } - term->output(widechar + L"bcdef"); + term_output->output(widechar + L"bcdef"); } TEST_F(TeletypeTest, WriteWideCharPastEOL) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); { @@ -327,12 +306,12 @@ TEST_F(TeletypeTest, WriteWideCharPastEOL) EXPECT_CALL(*teletype, set_last_line(StrEq(widechar))); } - term->output(widechar + widechar + widechar); + term_output->output(widechar + widechar + widechar); } TEST_F(TeletypeTest, WriteWideCharPastEOLWithSplit) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); { @@ -342,12 +321,12 @@ TEST_F(TeletypeTest, WriteWideCharPastEOLWithSplit) EXPECT_CALL(*teletype, set_last_line(StrEq(widechar + L"a"))); } - term->output(L"a" + widechar + widechar + L"a"); + term_output->output(L"a" + widechar + widechar + L"a"); } TEST_F(TeletypeTest, testOverwritePastEOL) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(5)); { @@ -359,16 +338,18 @@ TEST_F(TeletypeTest, testOverwritePastEOL) EXPECT_CALL(*teletype, set_last_line(StrEq(L"fghij"))); } - term->output(L"12345"); - term->output(L"\rabcdefghij"); + term_output->output(L"12345"); + term_output->output(L"\rabcdefghij"); } TEST_F(TeletypeTest, TeletypeDoesNotBreakTerminalMock) { - shared_ptr<mocks::terminal> term = mocks::create_combining_terminal(); - shared_ptr<mocks::teletype> teletype = mocks::create_teletype(term, term_locale); + shared_ptr<mocks::combining_terminal_output> real_term_output = + mocks::combining_terminal_output::create(); + shared_ptr<mocks::teletype> teletype = + mocks::create_teletype(term_locale, term_metrics, real_term_output); - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(80)); { @@ -377,14 +358,14 @@ TEST_F(TeletypeTest, TeletypeDoesNotBreakTerminalMock) EXPECT_CALL(*teletype, set_last_line(StrEq(L"a "))); } - term->write_text(L"abc"); - term->flush(); + real_term_output->write_text(L"abc"); + real_term_output->flush(); - term->move_to_beginning_of_line(); - term->write_text(L" "); - term->move_to_beginning_of_line(); - term->write_text(L"a"); - term->flush(); + real_term_output->move_to_beginning_of_line(); + real_term_output->write_text(L" "); + real_term_output->move_to_beginning_of_line(); + real_term_output->write_text(L"a"); + real_term_output->flush(); } diff --git a/tests/test_terminal_mock.cc b/tests/test_terminal_mock.cc index ba303fd6..86574f59 100644 --- a/tests/test_terminal_mock.cc +++ b/tests/test_terminal_mock.cc @@ -23,7 +23,6 @@ namespace mocks = aptitude::cmdline::mocks; -using aptitude::cmdline::terminal; using boost::shared_ptr; using testing::InSequence; using testing::StrEq; @@ -34,11 +33,11 @@ namespace { struct TerminalMock : public Test { - boost::shared_ptr<mocks::terminal> terminal; + boost::shared_ptr<mocks::combining_terminal_output> terminal; public: TerminalMock() - : terminal(mocks::create_combining_terminal()) + : terminal(mocks::combining_terminal_output::create()) { } }; @@ -54,7 +53,6 @@ TEST_F(TerminalMock, WriteEmptyStringDoesNotOutput) { EXPECT_CALL(*terminal, output(_)) .Times(0); - EXPECT_CALL(*terminal, flush()); terminal->write_text(L""); terminal->flush(); @@ -64,8 +62,6 @@ TEST_F(TerminalMock, WritesMustBeFlushed) { EXPECT_CALL(*terminal, output(_)) .Times(0); - EXPECT_CALL(*terminal, flush()) - .Times(0); // Nothing should be called by this: terminal->write_text(L"abc"); @@ -81,12 +77,7 @@ TEST_F(TerminalMock, MoveToBeginningOfLineMustBeFlushed) TEST_F(TerminalMock, WriteAndFlush) { - { - InSequence dummy; - - EXPECT_CALL(*terminal, output(StrEq(L"abc"))); - EXPECT_CALL(*terminal, flush()); - } + EXPECT_CALL(*terminal, output(StrEq(L"abc"))); terminal->write_text(L"abc"); terminal->flush(); @@ -94,12 +85,7 @@ TEST_F(TerminalMock, WriteAndFlush) TEST_F(TerminalMock, MoveToBeginningOfLineAndFlush) { - { - InSequence dummy; - - EXPECT_CALL(*terminal, output(StrEq(L"\r"))); - EXPECT_CALL(*terminal, flush()); - } + EXPECT_CALL(*terminal, output(StrEq(L"\r"))); terminal->move_to_beginning_of_line(); terminal->flush(); @@ -108,21 +94,13 @@ TEST_F(TerminalMock, MoveToBeginningOfLineAndFlush) TEST_F(TerminalMock, NewlineIsImplicitFlush) { EXPECT_CALL(*terminal, output(StrEq(L"abc\n"))); - EXPECT_CALL(*terminal, flush()) - .Times(0); terminal->write_text(L"abc\n"); } TEST_F(TerminalMock, DoubleFlushDoesNotOutput) { - { - InSequence dummy; - - EXPECT_CALL(*terminal, output(StrEq(L"def"))); - EXPECT_CALL(*terminal, flush()); - EXPECT_CALL(*terminal, flush()); - } + EXPECT_CALL(*terminal, output(StrEq(L"def"))); terminal->write_text(L"def"); terminal->flush(); @@ -131,9 +109,6 @@ TEST_F(TerminalMock, DoubleFlushDoesNotOutput) TEST_F(TerminalMock, DoubleNewlineOutputsTwice) { - EXPECT_CALL(*terminal, flush()) - .Times(0); - { InSequence dummy; @@ -153,7 +128,6 @@ TEST_F(TerminalMock, MultipleNewlines) EXPECT_CALL(*terminal, output(StrEq(L"I like\n"))); EXPECT_CALL(*terminal, output(StrEq(L"bunnies!\n"))); EXPECT_CALL(*terminal, output(StrEq(L" -- Burble"))); - EXPECT_CALL(*terminal, flush()); } terminal->write_text(L"abc\nI like\nbunnies!\n -- Burble"); @@ -162,12 +136,7 @@ TEST_F(TerminalMock, MultipleNewlines) TEST_F(TerminalMock, FlushAfterNewlineDoesNotOutput) { - { - InSequence dummy; - - EXPECT_CALL(*terminal, output(StrEq(L"xyz\n"))); - EXPECT_CALL(*terminal, flush()); - } + EXPECT_CALL(*terminal, output(StrEq(L"xyz\n"))); terminal->write_text(L"xyz\n"); terminal->flush(); @@ -177,12 +146,7 @@ TEST_F(TerminalMock, FlushAfterNewlineDoesNotOutput) TEST_F(TerminalMock, FlushCombinesWrites) { - { - InSequence dummy; - - EXPECT_CALL(*terminal, output(StrEq(L"abcdef"))); - EXPECT_CALL(*terminal, flush()); - } + EXPECT_CALL(*terminal, output(StrEq(L"abcdef"))); terminal->write_text(L"abc"); terminal->write_text(L"def"); @@ -191,12 +155,7 @@ TEST_F(TerminalMock, FlushCombinesWrites) TEST_F(TerminalMock, FlushCombinesWritesWithMoveToBeginningOfLine) { - { - InSequence dummy; - - EXPECT_CALL(*terminal, output(StrEq(L"abc\rdef\rghi"))); - EXPECT_CALL(*terminal, flush()); - } + EXPECT_CALL(*terminal, output(StrEq(L"abc\rdef\rghi"))); terminal->write_text(L"abc"); terminal->move_to_beginning_of_line(); @@ -208,9 +167,6 @@ TEST_F(TerminalMock, FlushCombinesWritesWithMoveToBeginningOfLine) TEST_F(TerminalMock, NewlineCombinesWrites) { - EXPECT_CALL(*terminal, flush()) - .Times(0); - EXPECT_CALL(*terminal, output(StrEq(L"xyzzy\n"))); terminal->write_text(L"xyz"); @@ -220,8 +176,6 @@ TEST_F(TerminalMock, NewlineCombinesWrites) TEST_F(TerminalMock, newlineCombinesWritesWithMoveToBeginningOfLine) { EXPECT_CALL(*terminal, output(StrEq(L"abc\rdef\n"))); - EXPECT_CALL(*terminal, flush()) - .Times(0); terminal->write_text(L"abc"); terminal->move_to_beginning_of_line(); @@ -240,7 +194,6 @@ TEST_F(TerminalMock, CombineAndSplit) EXPECT_CALL(*terminal, output(StrEq(L"de\rfg\n"))); EXPECT_CALL(*terminal, output(StrEq(L"hijklmn\n"))); EXPECT_CALL(*terminal, output(StrEq(L"op"))); - EXPECT_CALL(*terminal, flush()); } terminal->write_text(L"a"); diff --git a/tests/test_transient_message.cc b/tests/test_transient_message.cc index 08401a89..8aa00c12 100644 --- a/tests/test_transient_message.cc +++ b/tests/test_transient_message.cc @@ -47,8 +47,9 @@ namespace struct TransientMessage : public Test { - shared_ptr<mocks::terminal> term; shared_ptr<mocks::terminal_locale> term_locale; + shared_ptr<mocks::terminal_metrics> term_metrics; + shared_ptr<mocks::combining_terminal_output> term_output; shared_ptr<mocks::teletype> teletype; shared_ptr<transient_message> message; std::wstring widechar; @@ -56,13 +57,22 @@ namespace // I need to set up expectations on the terminal during member // initialization, since some of the other member initializers // cause methods to be invoked on it. - static shared_ptr<mocks::terminal> create_terminal() + static shared_ptr<mocks::combining_terminal_output> create_terminal_output() { - shared_ptr<mocks::terminal> rval = mocks::create_combining_terminal(); + shared_ptr<mocks::combining_terminal_output> rval = + mocks::combining_terminal_output::create(); EXPECT_CALL(*rval, output_is_a_terminal()) .WillRepeatedly(Return(true)); + return rval; + } + + static shared_ptr<mocks::terminal_metrics> create_terminal_metrics() + { + shared_ptr<mocks::terminal_metrics> rval = + mocks::terminal_metrics::create(); + EXPECT_CALL(*rval, get_screen_width()) .WillRepeatedly(Return(80)); @@ -70,10 +80,11 @@ namespace } TransientMessage() - : term(create_terminal()), - term_locale(mocks::terminal_locale::create()), - teletype(mocks::create_teletype(term, term_locale)), - message(create_transient_message(term, term_locale)), + : term_locale(mocks::terminal_locale::create()), + term_metrics(create_terminal_metrics()), + term_output(create_terminal_output()), + teletype(mocks::create_teletype(term_locale, term_metrics, term_output)), + message(create_transient_message(term_locale, term_metrics, term_output)), widechar(1, two_column_char) { EXPECT_CALL(*term_locale, wcwidth(two_column_char)) @@ -108,7 +119,7 @@ TEST_F(TransientMessage, DisplayAndAdvanceBasic) TEST_F(TransientMessage, DisplayAndAdvanceWrapping) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); { @@ -232,7 +243,7 @@ TEST_F(TransientMessage, ReplaceWideCharTextWithLonger) TEST_F(TransientMessage, TruncateLongLine) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); EXPECT_CALL(*teletype, set_last_line(StrTrimmedRightEq("abcd"))); @@ -242,7 +253,7 @@ TEST_F(TransientMessage, TruncateLongLine) TEST_F(TransientMessage, ReplaceTruncatedLongLineWithNonTruncated) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); { @@ -258,7 +269,7 @@ TEST_F(TransientMessage, ReplaceTruncatedLongLineWithNonTruncated) TEST_F(TransientMessage, ReplaceTruncatedLongLineWithTruncated) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); { @@ -274,7 +285,7 @@ TEST_F(TransientMessage, ReplaceTruncatedLongLineWithTruncated) TEST_F(TransientMessage, TruncateWideCharLine) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); EXPECT_CALL(*teletype, set_last_line(StrTrimmedRightEq(L"ab" + widechar))); @@ -284,7 +295,7 @@ TEST_F(TransientMessage, TruncateWideCharLine) TEST_F(TransientMessage, TruncateWideCharLineWithSplit) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); EXPECT_CALL(*teletype, set_last_line(StrTrimmedRightEq(L"abc"))); @@ -294,7 +305,7 @@ TEST_F(TransientMessage, TruncateWideCharLineWithSplit) TEST_F(TransientMessage, ReplaceTruncatedWideCharLine) { - EXPECT_CALL(*term, get_screen_width()) + EXPECT_CALL(*term_metrics, get_screen_width()) .WillRepeatedly(Return(4)); { @@ -310,7 +321,7 @@ TEST_F(TransientMessage, ReplaceTruncatedWideCharLine) TEST_F(TransientMessage, RequireTtyDecorationsWithTty) { - EXPECT_CALL(*term, output_is_a_terminal()) + EXPECT_CALL(*term_output, output_is_a_terminal()) .WillRepeatedly(Return(true)); { @@ -323,7 +334,7 @@ TEST_F(TransientMessage, RequireTtyDecorationsWithTty) // Need to create a new message object since it reads and caches the // value of output_is_a_terminal() when it's created. const shared_ptr<transient_message> requiring_message = - create_transient_message(term, term_locale); + create_transient_message(term_locale, term_metrics, term_output); requiring_message->set_text(L"abc"); requiring_message->set_text(L"xyz"); @@ -331,7 +342,7 @@ TEST_F(TransientMessage, RequireTtyDecorationsWithTty) TEST_F(TransientMessage, RequireTtyDecorationsWithoutTty) { - EXPECT_CALL(*term, output_is_a_terminal()) + EXPECT_CALL(*term_output, output_is_a_terminal()) .WillRepeatedly(Return(false)); EXPECT_CALL(*teletype, set_last_line(_)) @@ -340,7 +351,7 @@ TEST_F(TransientMessage, RequireTtyDecorationsWithoutTty) // Need to create a new message object since it reads and caches the // value of output_is_a_terminal() when it's created. const shared_ptr<transient_message> requiring_message = - create_transient_message(term, term_locale); + create_transient_message(term_locale, term_metrics, term_output); requiring_message->set_text(L"abc"); requiring_message->set_text(L"xyz"); |