Commit 7384850d authored by Emanuele Sabetta's avatar Emanuele Sabetta
Browse files

W3CTTestRunner: Added a console log at the bottom to avoid annoying message...

W3CTTestRunner: Added a console log at the bottom to avoid annoying message boxes popups and to have a log to copy with a contextual menu to easily report errors.
parent 44173b47
namespace SvgW3CTestRunner using System.Drawing;
namespace SvgW3CTestRunner
{ {
partial class View partial class View
{ {
...@@ -28,8 +30,10 @@ ...@@ -28,8 +30,10 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.lstFiles = new System.Windows.Forms.ListBox(); this.lstFiles = new System.Windows.Forms.ListBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.boxConsoleLog = new System.Windows.Forms.RichTextBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.picSaveLoad = new System.Windows.Forms.PictureBox(); this.picSaveLoad = new System.Windows.Forms.PictureBox();
...@@ -66,6 +70,20 @@ ...@@ -66,6 +70,20 @@
this.lstFiles.Size = new System.Drawing.Size(174, 744); this.lstFiles.Size = new System.Drawing.Size(174, 744);
this.lstFiles.TabIndex = 0; this.lstFiles.TabIndex = 0;
this.lstFiles.SelectedIndexChanged += new System.EventHandler(this.lstFiles_SelectedIndexChanged); this.lstFiles.SelectedIndexChanged += new System.EventHandler(this.lstFiles_SelectedIndexChanged);
//
// boxConsoleLog
//
this.boxConsoleLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.boxConsoleLog.Multiline = true;
this.boxConsoleLog.Location = new System.Drawing.Point(183, 744);
this.boxConsoleLog.Name = "ConsoleLog";
this.boxConsoleLog.Size = new System.Drawing.Size(1240, 144);
this.boxConsoleLog.TabIndex = 0;
this.boxConsoleLog.MouseDown += new System.Windows.Forms.MouseEventHandler (this.boxConsoleLog_MouseDown);
this.boxConsoleLog.ReadOnly = true;
this.boxConsoleLog.BackColor = Color.White;
// //
// tableLayoutPanel1 // tableLayoutPanel1
// //
...@@ -74,12 +92,13 @@ ...@@ -74,12 +92,13 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 1, 0); this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.lstFiles, 0, 0); this.tableLayoutPanel1.Controls.Add(this.lstFiles, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Controls.Add(this.boxConsoleLog, 1, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1249, 750); this.tableLayoutPanel1.Size = new System.Drawing.Size(1249, 750+144);
this.tableLayoutPanel1.TabIndex = 1; this.tableLayoutPanel1.TabIndex = 1;
// //
// splitContainer1 // splitContainer1
...@@ -98,7 +117,8 @@ ...@@ -98,7 +117,8 @@
this.splitContainer1.Size = new System.Drawing.Size(1063, 744); this.splitContainer1.Size = new System.Drawing.Size(1063, 744);
this.splitContainer1.SplitterDistance = 548; this.splitContainer1.SplitterDistance = 548;
this.splitContainer1.TabIndex = 0; this.splitContainer1.TabIndex = 0;
//
//
// tableLayoutPanel2 // tableLayoutPanel2
// //
this.tableLayoutPanel2.ColumnCount = 1; this.tableLayoutPanel2.ColumnCount = 1;
...@@ -246,7 +266,7 @@ ...@@ -246,7 +266,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1249, 774); this.ClientSize = new System.Drawing.Size(1249, 774+200);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
...@@ -274,6 +294,7 @@ ...@@ -274,6 +294,7 @@
#endregion #endregion
private System.Windows.Forms.RichTextBox boxConsoleLog;
private System.Windows.Forms.ListBox lstFiles; private System.Windows.Forms.ListBox lstFiles;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.SplitContainer splitContainer1;
......
...@@ -8,6 +8,7 @@ using System.IO; ...@@ -8,6 +8,7 @@ using System.IO;
using Svg; using Svg;
using System.Diagnostics; using System.Diagnostics;
namespace SvgW3CTestRunner namespace SvgW3CTestRunner
{ {
public partial class View : Form public partial class View : Form
...@@ -37,6 +38,34 @@ namespace SvgW3CTestRunner ...@@ -37,6 +38,34 @@ namespace SvgW3CTestRunner
lstFiles.Items.AddRange(files.ToArray()); lstFiles.Items.AddRange(files.ToArray());
} }
private void boxConsoleLog_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{ //click event
ContextMenu contextMenu = new System.Windows.Forms.ContextMenu();
MenuItem menuItem = new MenuItem("Copy");
menuItem.Click += new EventHandler(CopyAction);
contextMenu.MenuItems.Add(menuItem);
boxConsoleLog.ContextMenu = contextMenu;
}
}
void CopyAction(object sender, EventArgs e)
{
if (boxConsoleLog.SelectedText != null && boxConsoleLog.SelectedText != "")
{
//Clipboard.SetText(boxConsoleLog.SelectedText.Replace("\n", "\r\n"));
boxConsoleLog.Copy ();
}
}
private void lstFiles_SelectedIndexChanged(object sender, EventArgs e) private void lstFiles_SelectedIndexChanged(object sender, EventArgs e)
{ {
//render svg //render svg
...@@ -61,12 +90,18 @@ namespace SvgW3CTestRunner ...@@ -61,12 +90,18 @@ namespace SvgW3CTestRunner
var img = new Bitmap(480, 360); var img = new Bitmap(480, 360);
doc.Draw(img); doc.Draw(img);
picSvg.Image = img; picSvg.Image = img;
} }
this.boxConsoleLog.AppendText ("\n\nWC3 TEST " + fileName + "\n");
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.ToString(), "SVG Rendering"); this.boxConsoleLog.AppendText ("Result: TEST FAILED\n");
this.boxConsoleLog.AppendText ("SVG RENDERING ERROR for " + fileName + "\n");
this.boxConsoleLog.AppendText (ex.ToString());
//MessageBox.Show(ex.ToString(), "SVG Rendering");
picSvg.Image = null; picSvg.Image = null;
} }
...@@ -99,7 +134,10 @@ namespace SvgW3CTestRunner ...@@ -99,7 +134,10 @@ namespace SvgW3CTestRunner
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.ToString(), "SVG Serialization"); this.boxConsoleLog.AppendText ("Result: TEST FAILED\n");
this.boxConsoleLog.AppendText ("SVG SERIALIZATION ERROR for " + fileName + "\n");
this.boxConsoleLog.AppendText (ex.ToString());
//MessageBox.Show(ex.ToString(), "SVG Serialization");
picSaveLoad.Image = null; picSaveLoad.Image = null;
} }
...@@ -110,9 +148,15 @@ namespace SvgW3CTestRunner ...@@ -110,9 +148,15 @@ namespace SvgW3CTestRunner
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.ToString(), "SVG Comparison"); this.boxConsoleLog.AppendText ("Result: TEST FAILED\n");
this.boxConsoleLog.AppendText ("SVG TO PNG COMPARISON ERROR for " + fileName + "\n");
this.boxConsoleLog.AppendText (ex.ToString());
//MessageBox.Show(ex.ToString(), "SVG Comparison");
picSVGPNG.Image = null; picSVGPNG.Image = null;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment