// Render the given course id (0 = all controls) and kind to a map, and compare it to the saved version. internal void CheckRenderMapStandardChange(string filename, Id <Course> id, DescriptionKind kind, string newDescStandard) { SymbolDB symbolDB = new SymbolDB(Util.GetFileInAppDirectory("symbols.xml")); UndoMgr undomgr = new UndoMgr(5); EventDB eventDB = new EventDB(undomgr); CourseView courseView; eventDB.Load(filename); symbolDB.Standard = eventDB.GetEvent().descriptionStandard; eventDB.Validate(); courseView = CourseView.CreateViewingCourseView(eventDB, DesignatorFromCourseId(eventDB, id)); DescriptionFormatter descFormatter = new DescriptionFormatter(courseView, symbolDB, DescriptionFormatter.Purpose.ForPrinting); DescriptionLine[] description = descFormatter.CreateDescription(kind == DescriptionKind.Symbols); Bitmap bmNew = RenderToMapThenToBitmap(symbolDB, description, kind, 1); TestUtil.CheckBitmapsBase(bmNew, DescriptionBrowser.GetBitmapFileName(eventDB, id, "_std_default", kind)); undomgr.BeginCommand(71231, "change standard"); symbolDB.Standard = newDescStandard; ChangeEvent.UpdateDescriptionToMatchStandard(eventDB, symbolDB); undomgr.EndCommand(71231); description = descFormatter.CreateDescription(kind == DescriptionKind.Symbols); bmNew = RenderToMapThenToBitmap(symbolDB, description, kind, 1); TestUtil.CheckBitmapsBase(bmNew, DescriptionBrowser.GetBitmapFileName(eventDB, id, "_std_" + newDescStandard, kind)); }
// Render the given course id (0 = all controls) and kind to a bitmap, and compare it to the saved version. internal void CheckRenderBitmap(string filename, Id <Course> id, DescriptionKind kind, int numColumns = 1) { SymbolDB symbolDB = new SymbolDB(Util.GetFileInAppDirectory("symbols.xml")); UndoMgr undomgr = new UndoMgr(5); EventDB eventDB = new EventDB(undomgr); CourseView courseView; eventDB.Load(filename); eventDB.Validate(); courseView = CourseView.CreateViewingCourseView(eventDB, DesignatorFromCourseId(eventDB, id)); DescriptionFormatter descFormatter = new DescriptionFormatter(courseView, symbolDB, DescriptionFormatter.Purpose.ForPrinting); DescriptionLine[] description = descFormatter.CreateDescription(kind == DescriptionKind.Symbols); Bitmap bmNew = DescriptionBrowser.RenderToBitmap(symbolDB, description, kind, numColumns); if (numColumns > 1) { TestUtil.CheckBitmapsBase(bmNew, DescriptionBrowser.GetBitmapFileName(eventDB, id, "_" + numColumns + "col", kind)); } else { TestUtil.CheckBitmapsBase(bmNew, DescriptionBrowser.GetBitmapFileName(eventDB, id, "", kind)); } }
// Render the given course id (0 = all controls) and kind to a bitmap, and compare it to the saved version. internal void CheckRenderBitmapPixelAtATime(Id <Course> id, DescriptionKind kind) { SymbolDB symbolDB = new SymbolDB(Util.GetFileInAppDirectory("symbols.xml")); UndoMgr undomgr = new UndoMgr(5); EventDB eventDB = new EventDB(undomgr); CourseView courseView; eventDB.Load(TestUtil.GetTestFile("descriptions\\sampleevent1.coursescribe")); eventDB.Validate(); courseView = CourseView.CreateViewingCourseView(eventDB, new CourseDesignator(id)); DescriptionFormatter descFormatter = new DescriptionFormatter(courseView, symbolDB, DescriptionFormatter.Purpose.ForPrinting); DescriptionLine[] description = descFormatter.CreateDescription(false); Bitmap bmNew = RenderToBitmapPixelAtATime(symbolDB, description, kind); TestUtil.CheckBitmapsBase(bmNew, DescriptionBrowser.GetBitmapFileName(eventDB, id, "", kind)); }