View | Details | Raw Unified | Return to bug 485268
Collapse All | Expand All

(-)UiaAtkBridge/Test/UiaAtkBridgeTest/BridgeTester.cs (+7 lines)
Lines 116-124 Link Here
116
			AutomationInteropProvider.RaiseAutomationEvent (null, null, null);
116
			AutomationInteropProvider.RaiseAutomationEvent (null, null, null);
117
		}
117
		}
118
		
118
		
119
		public static void OnError (string message)
120
		{
121
			Assert.Fail (message);
122
		}
123
		
119
		[TestFixtureSetUp]
124
		[TestFixtureSetUp]
120
		public virtual void BridgeTesterInit ()
125
		public virtual void BridgeTesterInit ()
121
		{
126
		{
127
			Mono.UIAutomation.Services.Log.ErrorHapenned += OnError;
128
			
122
			InitializeA11y ();
129
			InitializeA11y ();
123
			
130
			
124
			form.Show ();
131
			form.Show ();
(-)UIAutomation/UIAutomationBridge/Mono.UIAutomation.Services/Log.cs (-12 / +18 lines)
Lines 56-61 Link Here
56
				} catch { }
56
				} catch { }
57
			}
57
			}
58
		}
58
		}
59
		
60
		public static event Action<string> ErrorHapenned;
59
61
60
		public static void Info (string message)
62
		public static void Info (string message)
61
		{
63
		{
Lines 111-140 Link Here
111
#region Private Methods
113
#region Private Methods
112
		private static void PrintMessage (LogLevel level, string message, object[] args)
114
		private static void PrintMessage (LogLevel level, string message, object[] args)
113
		{
115
		{
114
			if ((int)currentLogLevel > (int)level)
115
				return;
116
117
			// Code from Banshee under the MIT/X11 License
116
			// Code from Banshee under the MIT/X11 License
118
			Console.Error.Write ("[{0} {1:00}:{2:00}:{3:00}.{4:000}] ",
117
			string msg = String.Format ("[{0} {1:00}:{2:00}:{3:00}.{4:000}] ",
119
			                     GetLogLevelString (level),
118
			                            GetLogLevelString (level),
120
			                     DateTime.Now.Hour, DateTime.Now.Minute,
119
			                            DateTime.Now.Hour, DateTime.Now.Minute,
121
			                     DateTime.Now.Second, DateTime.Now.Millisecond); 
120
			                            DateTime.Now.Second, DateTime.Now.Millisecond);
122
121
			
123
			if (args == null)
122
			if (args == null)
124
				Console.Error.WriteLine (message);
123
				msg += message;
125
			else
124
			else
126
				Console.Error.WriteLine (message, args);
125
				msg += String.Format (message, args);
126
			
127
			if ((int)currentLogLevel > (int)level)
128
				Console.Error.WriteLine (msg);
129
			
130
			Action<string> handler = ErrorHapenned;
131
			if (handler != null && level == LogLevel.Error)
132
				handler (msg);
127
		}
133
		}
128
134
129
		private static string GetLogLevelString (LogLevel level)
135
		private static string GetLogLevelString (LogLevel level)
130
		{
136
		{
131
			switch (level) {
137
			switch (level) {
132
			case LogLevel.Information:
138
			case LogLevel.Information:
133
				return "Info ";
139
				return "Info";
134
			case LogLevel.Debug:
140
			case LogLevel.Debug:
135
				return "Debug";
141
				return "Debug";
136
			case LogLevel.Warning:
142
			case LogLevel.Warning:
137
				return "Warn ";
143
				return "Warn";
138
			case LogLevel.Error:
144
			case LogLevel.Error:
139
				return "Error";
145
				return "Error";
140
			}
146
			}

Return to bug 485268