Beispiel #1
0
        public override void DrawForeground(Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics)
        {
            isFailed = false;
            bool searchCases = false;

            Xwt.Drawing.Image icon = host.GetStatusIcon(unitTest.UnitTestIdentifier);
            if (icon != null)
            {
                if (host.HasResult(unitTest.UnitTestIdentifier))
                {
                    searchCases = true;
                }
                else if (host.IsFailure(unitTest.UnitTestIdentifier))
                {
                    failMessage = host.GetMessage(unitTest.UnitTestIdentifier);
                    isFailed    = true;
                }
            }
            else
            {
                searchCases = true;
            }

            if (searchCases)
            {
                foreach (var caseId in unitTest.TestCases)
                {
                    icon = host.GetStatusIcon(unitTest.UnitTestIdentifier, caseId);
                    if (host.IsFailure(unitTest.UnitTestIdentifier, caseId))
                    {
                        failMessage = host.GetMessage(unitTest.UnitTestIdentifier, caseId);
                        isFailed    = true;
                        break;
                    }
                }
            }

            if (icon != null)
            {
                if (icon.Width > metrics.Width || icon.Height > metrics.Height)
                {
                    icon = icon.WithBoxSize(metrics.Width, metrics.Height);
                }
                cr.DrawImage(editor, icon, Math.Truncate(metrics.X + metrics.Width / 2 - icon.Width / 2), Math.Truncate(metrics.Y + metrics.Height / 2 - icon.Height / 2));
            }
        }
Beispiel #2
0
        void UpdateStatusIcon()
        {
            isFailed = false;
            bool searchCases = false;

            statusIcon = host.GetStatusIcon(unitTest.UnitTestIdentifier);
            if (statusIcon != null)
            {
                if (host.HasResult(unitTest.UnitTestIdentifier))
                {
                    searchCases = true;
                }
                else if (host.IsFailure(unitTest.UnitTestIdentifier))
                {
                    failMessage = host.GetMessage(unitTest.UnitTestIdentifier);
                    isFailed    = true;
                }
            }
            else
            {
                searchCases = true;
            }

            if (searchCases)
            {
                foreach (var caseId in unitTest.TestCases)
                {
                    statusIcon = host.GetStatusIcon(unitTest.UnitTestIdentifier, caseId);
                    if (host.IsFailure(unitTest.UnitTestIdentifier, caseId))
                    {
                        failMessage = host.GetMessage(unitTest.UnitTestIdentifier, caseId);
                        isFailed    = true;
                        break;
                    }
                }
            }
        }