OTest2
A C++ testing framework
testmarkformatterassert.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Ondrej Starek
3  *
4  * This file is part of OTest2
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
21 
22 #include <assert.h>
23 
24 #include <assertstream.h>
25 
26 namespace OTest2 {
27 
29  AssertStream* stream_,
30  const std::string& prefix_) :
31  TestMarkFormatterIOS(stream_, prefix_),
32  stream(stream_) {
33  assert(stream != nullptr);
34 
35 }
36 
38 
39 void TestMarkFormatterAssert::setTextForeground(
40  Color color_) {
41  *stream << foreground(color_);
42 }
43 
44 void TestMarkFormatterAssert::setTextStyle(
45  Style style_) {
46  *stream << textStyle(style_);
47 }
48 
49 void TestMarkFormatterAssert::resetTextAttributes() {
50  *stream << resetAttrs();
51 }
52 
53 } /* -- namespace OTest2 */
OTest2::resetAttrs
Private::Manipulator resetAttrs()
Reset color and style attributes - manipulator.
Definition: assertstream.cpp:192
OTest2::textStyle
Private::Manipulator< Style > textStyle(Style style_)
Text style manipulator.
Definition: assertstream.cpp:187
OTest2::Style
Style
Style of shown text.
Definition: reporterattributes.h:44
assertstream.h
OTest2::TestMarkFormatterAssert::TestMarkFormatterAssert
TestMarkFormatterAssert(const TestMarkFormatterAssert &)=delete
testmarkformatterassert.h
OTest2::Color
Color
List of colors supported by the reporters.
Definition: reporterattributes.h:30
OTest2
Definition: assertbean.h:25
OTest2::AssertStream
Assertion stream.
Definition: assertstream.h:40
OTest2::TestMarkFormatterAssert::~TestMarkFormatterAssert
virtual ~TestMarkFormatterAssert()
Dtor.
OTest2::TestMarkFormatterIOS
Implementation of the testmark formatter based on an IO stream.
Definition: testmarkformatterios.h:33
OTest2::foreground
Private::Manipulator< Color > foreground(Color color_)
Foreground color manipulator.
Definition: assertstream.cpp:177