Summary description for XApp.
Inheritance: SIL.FieldWorks.Common.Framework.FwApp
Esempio n. 1
0
		/// <summary>non-undoable task because setting up an StText must be done in a Unit of Work</summary>
		private void DoSetupFixture()
		{
			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;

			// set up default vernacular ws.
			m_wsDefaultVern = Cache.ServiceLocator.WritingSystemManager.Get("fr");
			m_wsOtherVern = Cache.ServiceLocator.WritingSystemManager.Get("es");
			m_wsEn = Cache.ServiceLocator.WritingSystemManager.Get("en");
			Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(m_wsOtherVern);
			Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Add(m_wsOtherVern);
			Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(m_wsDefaultVern);
			Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Insert(0, m_wsDefaultVern);

			// set up an StText with an empty paragraph with default Contents (empty English TsString)
			m_sttNoExplicitWs = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			Cache.ServiceLocator.GetInstance<ITextFactory>().Create().ContentsOA = m_sttNoExplicitWs;
			m_sttNoExplicitWs.AddNewTextPara(null);
			Assert.AreEqual(m_wsEn.Handle, m_sttNoExplicitWs.MainWritingSystem, "Our code counts on English being the defualt WS for very empty texts");

			// set up an StText with an empty paragraph with an empty TsString in a non-default vernacular
			m_sttEmptyButWithWs = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			Cache.ServiceLocator.GetInstance<ITextFactory>().Create().ContentsOA = m_sttEmptyButWithWs;
			m_sttEmptyButWithWs.AddNewTextPara(null);
			((IStTxtPara)m_sttEmptyButWithWs.ParagraphsOS[0]).Contents = TsStringUtils.MakeTss(string.Empty, m_wsOtherVern.Handle);
		}
        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);
        }
Esempio n. 3
0
 public void FixtureCleanUp()
 {
     m_application.Dispose();
     if (m_window != null)
     {
         m_window.Dispose();
         m_window = null;
     }
     m_application = null;
     FwRegistrySettings.Release();
 }
Esempio n. 4
0
 public void FixtureCleanUp()
 {
     TearDown();
     m_application.Dispose();
     if (m_window != null)
     {
         m_window.Dispose();                 // also disposes mediator
         m_window = null;
     }
     m_application = null;
     FwRegistrySettings.Release();
 }
        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");
        }
Esempio n. 6
0
 protected XWorksAppTestBase()
 {
     m_application = null;
 }
Esempio n. 7
0
 public MockFwXWindow(FwXApp application, string configFile)
     : base(application, configFile)
 {
 }
Esempio n. 8
0
		public XWorksAppTestBase()
		{
			m_application =null;
		}
Esempio n. 9
0
 public XWorksAppTestBase()
 {
     m_application = null;
 }