示例#1
0
        /// <summary>
        /// Applies the test framework styles to the control.
        /// </summary>
        /// <param name="control">The control reference.</param>
        public override void ApplyStyle(HtmlControl control)
        {
            // For all controls, set the default font and size

            WebBrowserTestPage.SetDefaultFont(control);
            WebBrowserTestPage.SetDefaultFontSize(control);
        }
示例#2
0
 /// <summary>
 /// Adds a row to the table.
 /// </summary>
 /// <param name="property">The property cell.</param>
 /// <param name="value">The value cell.</param>
 /// <returns>Returns the row HtmlControl.</returns>
 public HtmlControl AddRow(HtmlControl property, HtmlControl value)
 {
     HtmlControl row = new HtmlControl(HtmlTag.Tr);
     row.Controls.Add(CreateCell(property));
     row.Controls.Add(CreateCell(value));
     _body.Controls.Add(row);
     return row;
 }
示例#3
0
 /// <summary>
 /// Makes a control transparent.  Works with several browsers.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="opacity">The opacity amount.</param>
 private static void MakeTransparent(HtmlControl control, int opacity)
 {
     control.SetStyleAttribute("filter", "alpha(opacity=" + opacity + ")");
     control.SetStyleAttribute("-moz-opacity", "." + opacity);
     control.SetStyleAttribute("opacity", "." + opacity);
 }
示例#4
0
 /// <summary>
 /// Sets the font size of the control to be the default size for the 
 /// test framework.
 /// </summary>
 /// <param name="control">The managed HTML control.</param>
 public static void SetDefaultFontSize(HtmlControl control)
 {
     control.Font.Size = new FontUnit(DefaultFontSize);
 }
示例#5
0
 /// <summary>
 /// Sets the font of the control to be the default fixed-size font for 
 /// the test framework.
 /// </summary>
 /// <param name="control">The managed HTML control.</param>
 public static void SetDefaultFixedFont(HtmlControl control)
 {
     control.Font.Names = _defaultFixedFontFamilies;
 }
示例#6
0
        /// <summary>
        /// Initializes the HtmlTestPage Control with a specific minimum plugin 
        /// size requirement.
        /// </summary>
        /// <param name="minimumPluginWidth">The minimum width that the plugin 
        /// can be sized to.</param>
        /// <param name="minimumPluginHeight">The minimum height that the plugin
        /// can be sized to.</param>
        /// <param name="testColumnWidth">The width to allocate for the test 
        /// column.</param>
        /// <param name="permitResizing">A value indicating whether to allow 
        /// the plugin and page to resize the contents.</param>
        public WebBrowserTestPage(int minimumPluginWidth, int minimumPluginHeight, int testColumnWidth, bool permitResizing)
        {
            PrepareApplicationFonts();

            _testColumnWidth = testColumnWidth;
            _minimumPluginSize = new Size<int>(minimumPluginWidth, minimumPluginHeight);
            _pluginContainer = new HtmlControl(HtmlPage.Plugin.Parent);
            _plugin = new HtmlControl(HtmlPage.Plugin);

            CalculatePreferredPluginSize();

            if (permitResizing)
            {
                ResizeSilverlightPlugin();
            }
            
            // Appended directly into the document body
            _testColumn = new HtmlTestColumn(_testColumnWidth, ImplicitPadding, _browserClientSize.Height);
            HtmlPage.Document.Body.AppendChild(_testColumn);
        }
示例#7
0
 /// <summary>
 /// Applies the styles to the control.  Derived classes can customize 
 /// the type, tag, or other properties of the controls to limit when the 
 /// styles are applied.
 /// </summary>
 /// <param name="control">The control reference.</param>
 public virtual void ApplyStyle(HtmlControl control)
 {
     // The default implementation does nothing
 }
示例#8
0
 /// <summary>
 /// Initializes the component.
 /// </summary>
 private void InitializeComponent()
 {
     _body = new HtmlControl(HtmlTag.Tbody);
     Controls.Add(_body);
 }
示例#9
0
 /// <summary>
 /// Creates a cell element with content.
 /// </summary>
 /// <param name="content">The content of the cell.</param>
 /// <returns>Returns the cell.</returns>
 private static HtmlControl CreateCell(HtmlControl content)
 {
     HtmlControl cell = new HtmlControl(HtmlTag.Td);
     cell.Controls.Add(content);
     return cell;
 }
示例#10
0
 /// <summary>
 /// Adds a row to the table.
 /// </summary>
 /// <param name="property">The property value.</param>
 /// <param name="value">The string value.</param>
 /// <returns>Returns the row HtmlControl.</returns>
 public HtmlControl AddRow(string property, HtmlControl value)
 {
     return AddRow(new Paragraph(property), value);
 }
示例#11
0
            /// <summary>
            /// Adds the copy information action.
            /// </summary>
            /// <param name="actions">The action container.</param>
            private void AddCopyAction(HtmlControl actions)
            {
                HtmlAnchor copy = new HtmlAnchor(
                    "Copy result details",
                    delegate(object sender, HtmlEventArgs args)
                    {
			    //HtmlPage.Window.Alert(Inspector.Result.ToString());
                    });
                StyleActionLink(copy);
                actions.Controls.Add(copy);
            }
示例#12
0
 /// <summary>
 /// Adds the retry action link.
 /// </summary>
 /// <param name="actions">The action container.</param>
 private void AddRetryAction(HtmlControl actions)
 {
     HtmlAnchor rerun = new HtmlAnchor(
         "Retry this test",
         delegate(object sender, HtmlEventArgs args)
         {
             RetryTestRunFilter retryFilter = new RetryTestRunFilter(Inspector.Result.TestClass, Inspector.Result.TestMethod);
             UnitTestHarness ut = UnitTestHarness;
             if (ut != null)
             {
                 ut.RestartRunDispatcher();
                 ut.EnqueueTestAssembly(Inspector.Result.TestClass.Assembly, retryFilter);
             }
         });
     StyleActionLink(rerun);
     actions.Controls.Add(rerun);
 }
示例#13
0
 /// <summary>
 /// Apply bold formatting to all sub-controls in a row.
 /// </summary>
 /// <param name="row">Row control.</param>
 private static void BoldRow(HtmlControl row)
 {
     for (int i = 0; i < row.Controls.Count; ++i)
     {
         HtmlControl c = row.Controls[i] as HtmlControl;
         if (c != null)
         {
             c.Font.Bold = true;
         }
     }
 }
示例#14
0
        /// <summary>
        /// Records a failure and modifies the web page to allow linking between
        /// the failure summary, and also next and previous failure 
        /// functionality.
        /// </summary>
        /// <param name="method">Unit test provider's method reference.</param>
        /// <param name="methodNextSpan">Span that will contain the next button.</param>
        public void AddMethodFailure(ITestMethod method, HtmlControl methodNextSpan)
        {
            string id = PrefixIdentifier + _summary.GenerateNextFailureId().ToString(CultureInfo.InvariantCulture);

            HtmlAnchor anchor = new HtmlAnchor(id);
            StyleAnchor(anchor);
            anchor.Id = id;
            methodNextSpan.Controls.Add(anchor);

            // Link to the previous failure
            //---
            if (_summary.FirstFailureEntry != null)
            {
                HtmlAnchor prev = new HtmlAnchor();
                StyleAnchor(prev);
                prev.Href = "#" + _summary.LastFailureEntry.Id;
                prev.Title = "Previous Failure";
                prev.Font.Underline = false;
                prev.ForegroundColor = Color.White;
                prev.InnerHtml = "&uarr;";

                methodNextSpan.Controls.Add(prev);
            }

            // Link to the next failure
            //---
            if (_summary.LastFailureEntry != null)
            {
                HtmlAnchor next = new HtmlAnchor();
                StyleAnchor(next);
                next.Href = "#" + id;
                next.Title = "Next Failure";
                next.Font.Underline = false;
                next.ForegroundColor = Color.White;
                next.InnerHtml = "&nbsp; &darr;";
                
                _summary.LastFailureEntry.Element.Controls.Add(next);
            }

            // The failure summary link
            //---
            HtmlAnchor link = new HtmlAnchor();
            StyleAnchor(link);
            link.Href = "#" + id;
            link.Display = CssDisplay.Block;
            link.InnerHtml = method.Name;
            Controls.Add(link);

            // Store this most recent failure's data
            //---
            _summary.LastFailureEntry = new FailureEntry
            {
                Id = id,
                Element = methodNextSpan
            };

            // Set the first entry if this is the first
            //---
            if (_summary.FirstFailureEntry == null)
            {
                _summary.FirstFailureEntry = _summary.LastFailureEntry;
            }
        }
示例#15
0
        /// <summary>
        /// Adds a failure visually.
        /// </summary>
        /// <param name="testClass">Test class metadata object.</param>
        /// <param name="method">Method metadata object.</param>
        /// <param name="methodNextSpan">The next method to work with.</param>
        public void AddFailure(
            ITestClass testClass,
            ITestMethod method,
            HtmlControl methodNextSpan)
        {
            if (_lastId == 0)
            {
                FirstFailure();
            }

            if (false == _classes.ContainsKey(testClass))
            {
                _classes[testClass] = new FailureControl(testClass, this);
                Controls.Add(_classes[testClass]);
            }

            _classes[testClass].AddMethodFailure(method, methodNextSpan);
        }