Ejemplo n.º 1
0
        protected override void OnContentRendered(EventArgs e)
        {
            base.OnContentRendered(e);

            MetaPanel morph = (MetaPanel)this.FindName("morph");

            foreach (ExpResult expResult in TestResults())
            {
                for (int i = 0; i < morph.Children.Count; i++)
                {
                    ButtonOutput morphChild = (ButtonOutput)morph.Children[i];
                    if ((string)morphChild.Content == expResult.Name)
                    {
                        if (!IsClose(expResult.RenderSize, morphChild.RenderSize))
                        {
                            throw new ApplicationException("Child " + expResult.Name + " Orig RenderSize " + expResult.RenderSize.ToString() + " != Morph RenderSize " + morphChild.RenderSize + " on " + Title);
                        }

                        Point relativeMorph = morphChild.TranslatePoint(new Point(0, 0), morph);
                        if (!IsClose(expResult.Location, relativeMorph))
                        {
                            throw new ApplicationException("Child " + expResult.Name + " Orig TopLeft " + expResult.ToString() + " != Morph TopLeft " + relativeMorph + " on " + Title);
                        }
                    }
                }
            }

            Close();
        }
Ejemplo n.º 2
0
        protected override void OnContentRendered(EventArgs e)
        {
            base.OnContentRendered(e);

            // Get access to the panel and the morph panel
            Panel     original = (Panel)this.FindName("original");
            MetaPanel morph    = (MetaPanel)this.FindName("morph");

            // Must still have the same number of children
            if (original.Children.Count != morph.Children.Count)
            {
                throw new ApplicationException("Number of children differs on " + Title);
            }

            for (int i = 0; i < original.Children.Count; i++)
            {
                UIElement originalChild = original.Children[i];
                UIElement morphChild    = morph.Children[i];

                if (!IsClose(originalChild.RenderSize, morphChild.RenderSize))
                {
                    throw new ApplicationException("Child " + i.ToString() + " Orig RenderSize " + originalChild.RenderSize.ToString() + " != Morph RenderSize " + morphChild.RenderSize + " on " + Title);
                }

                if (!IsClose(originalChild.DesiredSize, morphChild.DesiredSize))
                {
                    throw new ApplicationException("Child " + i.ToString() + " Orig DesiredSize " + originalChild.DesiredSize.ToString() + " != Morph DesiredSize " + morphChild.DesiredSize + " on " + Title);
                }

                Point relativeOriginal = originalChild.TranslatePoint(new Point(0, 0), original);
                Point relativeMorph    = morphChild.TranslatePoint(new Point(0, 0), morph);
                if (!IsClose(relativeOriginal, relativeMorph))
                {
                    throw new ApplicationException("Child " + i.ToString() + " Orig TopLeft " + relativeOriginal.ToString() + " != Morph TopLeft " + relativeMorph + " on " + Title);
                }
            }

            Close();
        }