[NUI] Rebase develnui (DevelNUI only patches --> master) (#3910)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Devel.Tests.Ubuntu / nunit.framework / Common / ExtendedTextWrapper.cs
1 // ***********************************************************************
2 // Copyright (c) 2015 Charlie Poole
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 // ***********************************************************************
23 #define PORTABLE
24 #define TIZEN
25 #define NUNIT_FRAMEWORK
26 #define NUNITLITE
27 #define NET_4_5
28 #define PARALLEL
29 using NUnit.Framework.TUnit;
30 using System.IO;
31 using System.Text;
32
33 namespace NUnit.Common
34 {
35     /// <summary>
36     /// ExtendedTextWrapper wraps a TextWriter and makes it
37     /// look like an ExtendedTextWriter. All style indications
38     /// are ignored. It's used when text is being written
39     /// to a file.
40     /// </summary>
41     public class ExtendedTextWrapper : ExtendedTextWriter
42     {
43         private TextWriter _writer;
44
45         public ExtendedTextWrapper(TextWriter writer)
46         {
47             _writer = writer;
48         }
49
50         #region TextWriter Overrides
51
52         /// <summary>
53         /// Write a single char value
54         /// </summary>
55         public override void Write(char value)
56         {
57             _writer.Write(value);
58         }
59
60         /// <summary>
61         /// Write a string value
62         /// </summary>
63         public override void Write(string value)
64         {
65             _writer.Write(value);
66         }
67
68         /// <summary>
69         /// Write a string value followed by a NewLine
70         /// </summary>
71         public override void WriteLine(string value)
72         {
73             _writer.WriteLine(TLogger.DefaultTag + value);
74         }
75
76         /// <summary>
77         /// Gets the encoding for this ExtendedTextWriter
78         /// </summary>
79         public override Encoding Encoding
80         {
81             get { return _writer.Encoding; }
82         }
83
84         /// <summary>
85         /// Dispose the Extended TextWriter
86         /// </summary>
87         protected override void Dispose(bool disposing)
88         {
89             _writer.Dispose();
90         }
91
92         #endregion
93
94         #region Extended Methods
95
96         /// <summary>
97         /// Writes the value with the specified style.
98         /// </summary>
99         /// <param name="style">The style.</param>
100         /// <param name="value">The value.</param>
101         public override void Write(ColorStyle style, string value)
102         {
103             Write(value);
104         }
105
106         /// <summary>
107         /// Writes the value with the specified style
108         /// </summary>
109         /// <param name="style">The style.</param>
110         /// <param name="value">The value.</param>
111         public override void WriteLine(ColorStyle style, string value)
112         {
113             WriteLine(value);
114         }
115
116         /// <summary>
117         /// Writes the label and the option that goes with it.
118         /// </summary>
119         /// <param name="label">The label.</param>
120         /// <param name="option">The option.</param>
121         public override void WriteLabel(string label, object option)
122         {
123             Write(label);
124             Write(option.ToString());
125         }
126
127         /// <summary>
128         /// Writes the label and the option that goes with it.
129         /// </summary>
130         /// <param name="label">The label.</param>
131         /// <param name="option">The option.</param>
132         /// <param name="valueStyle">The color to display the value with</param>
133         public override void WriteLabel(string label, object option, ColorStyle valueStyle)
134         {
135             WriteLabel(label, option);
136         }
137
138         /// <summary>
139         /// Writes the label and the option that goes with it followed by a new line.
140         /// </summary>
141         /// <param name="label">The label.</param>
142         /// <param name="option">The option.</param>
143         public override void WriteLabelLine(string label, object option)
144         {
145             WriteLabel(label, option);
146             WriteLine();
147         }
148
149         /// <summary>
150         /// Writes the label and the option that goes with it followed by a new line.
151         /// </summary>
152         /// <param name="label">The label.</param>
153         /// <param name="option">The option.</param>
154         /// <param name="valueStyle">The color to display the value with</param>
155         public override void WriteLabelLine(string label, object option, ColorStyle valueStyle)
156         {
157             WriteLabelLine(label, option);
158         }
159
160         #endregion
161     }
162 }