Example #1
0
        private void DrawAssemblyLine(Listing_Standard listing, Assembly asm)
        {
            Rect row             = listing.GetRect(HEIGHT_ROW);
            Rect runBtnRect      = row.LeftPartPixels(WIDTH_ROW_RUN);
            Rect timeRect        = row.RightPartPixels(row.width - runBtnRect.xMax).LeftPartPixels(WIDTH_TIME_LABEL);
            Rect errorRect       = row.RightPartPixels(row.width - (timeRect.xMax + WIDTH_LEVEL_INDENT * 0)).LeftPartPixels(WIDTH_ERROR_LEVEL);
            Rect toggleLabelRect = row.RightPartPixels(row.width - errorRect.xMax).LeftPartPixels(WIDTH_TOGGLE_LABEL);
            Rect messageRect     = row.RightPartPixels(row.width - toggleLabelRect.xMax);

            messageRect = messageRect.LeftPartPixels(messageRect.width - WIDTH_DETAILS_BTN);
            Rect detailsRect = row.RightPartPixels(WIDTH_DETAILS_BTN);

            Text.Font   = GameFont.Tiny;
            Text.Anchor = TextAnchor.MiddleCenter;
            // test run button
            if (Widgets.ButtonText(runBtnRect, "run"))
            //    if (Widgets.ButtonText(new Rect(new Vector2(row.xMin, row.yMin + currentRow * HEIGHT_ROW + HEIGHT_OPTIONS), SIZE_RUN_BTN), "run"))
            {
                Runner.RunAssembly(asm);
                TimeElapsedExplorer.UpdateAssemblyTimeElapsed(asm);
            }

            // Todo time data
            double timeElapsed = TimeElapsedExplorer.GetAssemblyTimeElapsed(asm);

            Widgets.Label(timeRect, $"{(timeElapsed == -1 ? "--" : $"{timeElapsed}")} ms");
Example #2
0
        private void DrawControls(Listing_Standard bar)
        {
            Rect rowAsm = bar.GetRect(HEIGHT_CONTROLS);
            Rect rowTS  = bar.GetRect(HEIGHT_CONTROLS);
            Rect rowT   = bar.GetRect(HEIGHT_CONTROLS);

            // ASM - COLLAPSE / EXPAND - STATUSES
            Rect asmLabelRect    = rowAsm.LeftPartPixels(WIDTH_CONTROLS_ASM_LABEL);
            Rect asmCollapseRect = rowAsm.RightPartPixels(rowAsm.width - asmLabelRect.xMax).LeftPartPixels(WIDTH_CONTROLS_ASM_COLLAPSE);
            Rect asmExpandRect   = rowAsm.RightPartPixels(rowAsm.width - asmCollapseRect.xMax).LeftPartPixels(WIDTH_CONTROLS_ASM_EXPAND);

            Widgets.Label(asmLabelRect, "Assemblies");
            if (Widgets.ButtonText(asmCollapseRect, "Collapse"))
            {
                CollapseAllAssemblies();
            }
            if (Widgets.ButtonText(asmExpandRect, "Expand"))
            {
                ExpandAllAssemblies();
            }
            Rect statusAsmLabelRect      = rowAsm.RightPartPixels(rowAsm.width - asmExpandRect.xMax - WIDTH_CONTROLS_SECTION_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_LABEL);
            Rect statusAsmControllerRect = rowAsm.RightPartPixels(rowAsm.width - statusAsmLabelRect.xMax);

            Rect statusAsmFailRect    = statusAsmControllerRect.LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusAsmWarnRect    = statusAsmControllerRect.RightPartPixels(statusAsmControllerRect.width - statusAsmFailRect.width - WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusAsmSkipRect    = statusAsmControllerRect.RightPartPixels(statusAsmControllerRect.width - 2 * statusAsmWarnRect.width - 2 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusAsmUnknownRect = statusAsmControllerRect.RightPartPixels(statusAsmControllerRect.width - 3 * statusAsmSkipRect.width - 3 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusAsmPassRect    = statusAsmControllerRect.RightPartPixels(statusAsmControllerRect.width - 4 * statusAsmUnknownRect.width - 4 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);

            Widgets.CheckboxLabeled(statusAsmFailRect, $"{StatusExplorer.GetAssemblyStatusCount(AssemblyStatus.ERROR)} {StatusSymbol(AssemblyStatus.ERROR)}", ref FilteredExplorer.failEnabledAsm);

            Widgets.CheckboxLabeled(statusAsmWarnRect, $"{StatusExplorer.GetAssemblyStatusCount(AssemblyStatus.WARNING)} {StatusSymbol(AssemblyStatus.WARNING)}", ref FilteredExplorer.warningEnabledAsm);

            Widgets.CheckboxLabeled(statusAsmUnknownRect, $"{StatusExplorer.GetAssemblyStatusCount(AssemblyStatus.UNKNOWN)} {StatusSymbol(AssemblyStatus.UNKNOWN)}", ref FilteredExplorer.unknownEnabledAsm);

            Widgets.CheckboxLabeled(statusAsmPassRect, $"{StatusExplorer.GetAssemblyStatusCount(AssemblyStatus.PASS)} {StatusSymbol(AssemblyStatus.PASS)}", ref FilteredExplorer.passEnabledAsm);

            // TESTSUITE - COLLAPSE / EXPAND - STATUSES
            Rect tsLabelRect    = rowTS.LeftPartPixels(WIDTH_CONTROLS_TS_LABEL);
            Rect tsCollapseRect = rowTS.RightPartPixels(rowTS.width - tsLabelRect.xMax).LeftPartPixels(WIDTH_CONTROLS_TS_COLLAPSE);
            Rect tsExpandRect   = rowTS.RightPartPixels(rowTS.width - tsCollapseRect.xMax).LeftPartPixels(WIDTH_CONTROLS_TS_EXPAND);

            Widgets.Label(tsLabelRect, "Test Suites");
            if (Widgets.ButtonText(tsCollapseRect, "Collapse"))
            {
                CollapseAllTestSuites();
            }
            if (Widgets.ButtonText(tsExpandRect, "Expand"))
            {
                ExpandAllTestSuites();
            }
            Rect statusTSLabelRect      = rowTS.RightPartPixels(rowTS.width - tsExpandRect.xMax - WIDTH_CONTROLS_SECTION_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_LABEL);
            Rect statusTSControllerRect = rowTS.RightPartPixels(rowTS.width - statusTSLabelRect.xMax);

            Rect statusTSFailRect    = statusTSControllerRect.LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusTSWarnRect    = statusTSControllerRect.RightPartPixels(statusTSControllerRect.width - statusTSFailRect.width - WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusTSSkipRect    = statusTSControllerRect.RightPartPixels(statusTSControllerRect.width - 2 * statusTSWarnRect.width - 2 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusTSUnknownRect = statusTSControllerRect.RightPartPixels(statusTSControllerRect.width - 3 * statusTSSkipRect.width - 3 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusTSPassRect    = statusTSControllerRect.RightPartPixels(statusTSControllerRect.width - 4 * statusTSUnknownRect.width - 4 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);

            Widgets.CheckboxLabeled(statusTSFailRect, $"{StatusExplorer.GetTestSuiteStatusCount(TestSuiteStatus.ERROR)} {StatusSymbol(TestSuiteStatus.ERROR)}", ref FilteredExplorer.failEnabledTS);

            Widgets.CheckboxLabeled(statusTSWarnRect, $"{StatusExplorer.GetTestSuiteStatusCount(TestSuiteStatus.WARNING)} {StatusSymbol(TestSuiteStatus.WARNING)}", ref FilteredExplorer.warningEnabledTS);

            Widgets.CheckboxLabeled(statusTSSkipRect, $"{StatusExplorer.GetTestSuiteStatusCount(TestSuiteStatus.SKIP)} {StatusSymbol(TestSuiteStatus.SKIP)}", ref FilteredExplorer.skipEnabledTS);

            Widgets.CheckboxLabeled(statusTSUnknownRect, $"{StatusExplorer.GetTestSuiteStatusCount(TestSuiteStatus.UNKNOWN)} {StatusSymbol(TestSuiteStatus.UNKNOWN)}", ref FilteredExplorer.unknownEnabledTS);

            Widgets.CheckboxLabeled(statusTSPassRect, $"{StatusExplorer.GetTestSuiteStatusCount(TestSuiteStatus.PASS)} {StatusSymbol(TestSuiteStatus.PASS)}", ref FilteredExplorer.passEnabledTS);

            // TEST - RUN ALL / LOG ALL - STATUSES

            Rect tLabelRect  = rowT.LeftPartPixels(WIDTH_CONTROLS_TS_LABEL);
            Rect tRunAllRect = rowT.RightPartPixels(rowT.width - tLabelRect.xMax).LeftPartPixels(WIDTH_CONTROLS_TS_COLLAPSE);
            Rect tLogAllRect = rowT.RightPartPixels(rowT.width - tRunAllRect.xMax).LeftPartPixels(WIDTH_CONTROLS_TS_EXPAND);

            Widgets.Label(tLabelRect, "Tests");
            if (Widgets.ButtonText(tRunAllRect, "Run all"))
            {
                Runner.RunAllRegisteredTests();
                StatusExplorer.UpdateAllStatusCounts();
                TimeElapsedExplorer.UpdateAllAssembliesTimeElapsed();
            }
            if (Widgets.ButtonText(tLogAllRect, "Log all"))
            {
                Viewer.LogTestsResults();
            }

            Rect statusTLabelRect      = rowT.RightPartPixels(rowT.width - tLogAllRect.xMax - WIDTH_CONTROLS_SECTION_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_LABEL);
            Rect statusTControllerRect = rowT.RightPartPixels(rowT.width - statusTLabelRect.xMax);

            Rect statusTFailRect    = statusTControllerRect.LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusTSkipRect    = statusTControllerRect.RightPartPixels(statusTControllerRect.width - 2 * statusTFailRect.width - 2 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusTUnknownRect = statusTControllerRect.RightPartPixels(statusTControllerRect.width - 3 * statusTSkipRect.width - 3 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);
            Rect statusTPassRect    = statusTControllerRect.RightPartPixels(statusTControllerRect.width - 4 * statusTUnknownRect.width - 4 * WIDTH_CONTROLS_CONTROL_GAP).LeftPartPixels(WIDTH_CONTROLS_VIEW_CONTROL);

            Widgets.CheckboxLabeled(statusTFailRect, $"{StatusExplorer.GetTestStatusCount(TestStatus.ERROR)} {StatusSymbol(TestStatus.ERROR)}", ref FilteredExplorer.failEnabledT);

            Widgets.CheckboxLabeled(statusTSkipRect, $"{StatusExplorer.GetTestStatusCount(TestStatus.SKIP)} {StatusSymbol(TestStatus.SKIP)}", ref FilteredExplorer.skipEnabledT);

            Widgets.CheckboxLabeled(statusTUnknownRect, $"{StatusExplorer.GetTestStatusCount(TestStatus.UNKNOWN)} {StatusSymbol(TestStatus.UNKNOWN)}", ref FilteredExplorer.unknownEnabledT);

            Widgets.CheckboxLabeled(statusTPassRect, $"{StatusExplorer.GetTestStatusCount(TestStatus.PASS)} {StatusSymbol(TestStatus.PASS)}", ref FilteredExplorer.passEnabledT);

            //// SEARCH
            Rect rowSearch         = bar.GetRect(HEIGHT_CONTROLS);
            Rect searchLabelRect   = rowSearch.LeftPartPixels(WIDTH_CONTROLS_SEARCH_LABEL);
            Rect searchControlRect = rowSearch.RightPartPixels(rowSearch.width - searchLabelRect.xMax);

            Widgets.Label(searchLabelRect, "Search :");
            try
            {
                string searchRegexTmp = Widgets.TextField(searchControlRect, searchRegex);
                if (searchRegexTmp != searchRegex)
                {
                    searchRegex = searchRegexTmp;
                    FilteredExplorer.UpdateFilter(new Regex(searchRegex));
                }
            }
            catch
            {
                FilteredExplorer.UpdateFilter(new Regex(@""));
            }
        }