public override void FixtureSetup() { base.FixtureSetup(); FwRegistrySettings.Init(); m_application = new MockFwXApp(new MockFwManager { Cache = Cache }, null, null); var configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname); m_window = new MockFwXWindow(m_application, configFilePath); ((MockFwXWindow)m_window).Init(Cache); // initializes Mediator values m_mediator = m_window.Mediator; m_mediator.AddColleague(new StubContentControlProvider()); m_window.LoadUI(configFilePath); // set up clerk to allow DictionaryPublicationDecorator to be created during the UploadToWebonaryController driven export const string reversalIndexClerk = @"<?xml version='1.0' encoding='UTF-8'?> <root> <clerks> <clerk id='entries'> <recordList owner='LexDb' property='Entries'/> </clerk> </clerks> <tools> <tool label='Dictionary' value='lexiconDictionary' icon='DocumentView'> <control> <dynamicloaderinfo assemblyPath='xWorks.dll' class='SIL.FieldWorks.XWorks.XhtmlDocView'/> <parameters area='lexicon' clerk='entries' layout='Bartholomew' layoutProperty='DictionaryPublicationLayout' editable='false' configureObjectName='Dictionary'/> </control> </tool> </tools> </root>" ; var doc = new XmlDocument(); doc.LoadXml(reversalIndexClerk); XmlNode clerkNode = doc.SelectSingleNode("//tools/tool[@label='Dictionary']//parameters[@area='lexicon']"); m_Clerk = RecordClerkFactory.CreateClerk(m_mediator, clerkNode, false); m_mediator.PropertyTable.SetProperty("ActiveClerk", m_Clerk); m_mediator.PropertyTable.SetProperty("ToolForAreaNamed_lexicon", "lexiconDictionary"); Cache.ProjectId.Path = Path.Combine(FwDirectoryFinder.SourceDirectory, "xWorks/xWorksTests/TestData/"); // setup style sheet and style to allow the css to generate during the UploadToWebonaryController driven export m_styleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); m_owningTable = new StyleInfoTable("AbbySomebody", (IWritingSystemManager)Cache.WritingSystemFactory); var fontInfo = new FontInfo(); var letHeadStyle = new TestStyle(fontInfo, Cache) { Name = CssGenerator.LetterHeadingStyleName, IsParagraphStyle = false }; var dictNormStyle = new TestStyle(fontInfo, Cache) { Name = CssGenerator.DictionaryNormal, IsParagraphStyle = true }; m_styleSheet.Styles.Add(letHeadStyle); m_styleSheet.Styles.Add(dictNormStyle); m_owningTable.Add(CssGenerator.LetterHeadingStyleName, letHeadStyle); m_owningTable.Add(CssGenerator.DictionaryNormal, dictNormStyle); }
public void SetUp() { RegistryHelper.CompanyName = "SIL"; RegistryHelper.ProductName = "FieldWorks"; FwRegistrySettings.Init(); m_RegistryKey = RegistryHelper.SettingsKey(FwSubKey.TE, "Dummy"); TeProjectSettings.InitSettings(m_RegistryKey); }
public override void FixtureSetup() { base.FixtureSetup(); Cache.ProjectId.Path = Path.Combine(Path.GetTempPath(), Cache.ProjectId.Name, Cache.ProjectId.Name + @".junk"); FwRegistrySettings.Init(); m_application = new MockFwXApp(new MockFwManager { Cache = Cache }, null, null); m_configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname); m_window = new MockFwXWindow(m_application, m_configFilePath); m_window.Init(Cache); // initializes Mediator values m_mediator = m_window.Mediator; m_mediator.AddColleague(new StubContentControlProvider()); m_window.LoadUI(m_configFilePath); // actually loads UI here; needed for non-null stylesheet LayoutCache.InitializePartInventories(Cache.ProjectId.Name, m_application, Cache.ProjectId.Path); }
public void FixtureInit() { FwRegistrySettings.Init(); Init(); // subclass version must create and set m_application m_configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname); // Setup for possibility loading [GetPossibilityOrCreateOne()] // and test data creation SetupFactoriesAndRepositories(); /* note that someday, when we write a test to test the persistence function, * set "TestRestoringFromTestSettings" the second time the application has run in order to pick up * the settings from the first run. The code for this is already in xWindow. */ //m_window.Show(); Why? Application.DoEvents(); //without this, tests may fail non-deterministically }
public override void FixtureSetup() { base.FixtureSetup(); FwRegistrySettings.Init(); m_application = new MockFwXApp(new MockFwManager { Cache = Cache }, null, null); var m_configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname); m_window = new MockFwXWindow(m_application, m_configFilePath); ((MockFwXWindow)m_window).Init(Cache); // initializes Mediator values m_mediator = m_window.Mediator; // Set up the mediator to look as if we are working in the Reversal Index area m_mediator.PropertyTable.SetProperty("ToolForAreaNamed_lexicon", "reversalEditComplete"); Cache.ProjectId.Path = Path.Combine(FwDirectoryFinder.SourceDirectory, "xWorks/xWorksTests/TestData/"); m_wsEn = Cache.WritingSystemFactory.GetWsFromStr("en"); m_wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr"); }