Ejemplo n.º 1
0
        private void GenerateOverlayBlock(string sourceFileName, string overlayText, StoryScreenshotType screenshotType)
        {
            var bubble = new SpeechBubble(overlayText);

            switch (screenshotType)
            {
            case StoryScreenshotType.Initial:
            {
                bubble.Shape       = BalloonShape.Rectangle;
                bubble.FillColor   = Color.Maroon;
                bubble.TextColor   = Color.White;
                bubble.BubbleWidth = 800;
                bubble.Height      = 400;
                break;
            }

            case StoryScreenshotType.Basic:
            {
                bubble.Shape     = BalloonShape.Ellipse;
                bubble.FillColor = Color.White;
                break;
            }

            case StoryScreenshotType.Completion:
            {
                bubble.Shape       = BalloonShape.Rectangle;
                bubble.FillColor   = Color.Chartreuse;
                bubble.BubbleWidth = 800;
                bubble.Height      = 400;
                break;
            }

            case StoryScreenshotType.DialogMessage:
            {
                bubble.Shape     = BalloonShape.Ellipse;
                bubble.FillColor = Color.PowderBlue;
                break;
            }

            case StoryScreenshotType.AcceptanceCriteria:
            {
                bubble.Shape     = BalloonShape.Rectangle;
                bubble.FillColor = Color.Thistle;
                break;
            }
            }

            bubble.RenderText(sourceFileName, true);
        }
Ejemplo n.º 2
0
        private void TakeScreenshot(string overlayText, StoryScreenshotType screenshotType)
        {
            string rootPath = ExecutionSettings.OutputPath(
                $@"StoryAcceptance\{_storyId}\{DateTime.Now.ToString("yyyyMMdd_HHmmss")}", true);

            string fileName = GetScreenshotFileName();

            string fullSavePath = Path.Combine(rootPath, fileName);

            Screenshot screenshot = _session.DriverSession.Driver.TakeScreenshot();

            if (screenshot.PersistScreenshot(fullSavePath))
            {
                if (!string.IsNullOrWhiteSpace(overlayText))
                {
                    GenerateOverlayBlock(fullSavePath, overlayText, screenshotType);
                    //Utility.Imaging.ImagingUtilities.OverlayTextOntoImage(fullSavePath, overlayText, true);
                }
            }

            _screenshots.Add(fileName);
        }