protected override void 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);
     ((MockFwXWindow)m_window).Init(Cache);             // initializes Mediator values
     m_mediator = m_window.Mediator;
 }
Exemplo n.º 2
0
 protected override void Init()
 {
     BootstrapSystem(new TestProjectId(BackendProviderType.kMemoryOnly, "TestProject"),
                     BackendBulkLoadDomain.Lexicon, new LcmSettings());
     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);
     ((MockFwXWindow)m_window).Init(Cache);             // initializes Mediator values
     m_propertyTable = m_window.PropTable;
 }
 protected void CreateAndInitializeNewWindow()
 {
     m_window = new MockFwXWindow(m_application, m_configFilePath); // (MockFwXApp)
     ((MockFwXWindow)m_window).Init(Cache);                         // initializes Mediator values
     m_mediator = m_window.Mediator;
     ((MockFwXWindow)m_window).ClearReplacements();
     // delete property table settings.
     Properties.RemoveLocalAndGlobalSettings();
     ProcessPendingItems();
     m_window.LoadUI(m_configFilePath);             // actually loads UI here.
     NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, CreateTestData);
 }
		protected void CreateAndInitializeNewWindow()
		{
			m_window = new MockFwXWindow(m_application, m_configFilePath); // (MockFwXApp)
			((MockFwXWindow)m_window).Init(Cache); // initializes Mediator values
			m_mediator = m_window.Mediator;
			((MockFwXWindow)m_window).ClearReplacements();
			// delete property table settings.
			Properties.RemoveLocalAndGlobalSettings();
			ProcessPendingItems();
			m_window.LoadUI(m_configFilePath); // actually loads UI here.
			NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, CreateTestData);
		}
Exemplo n.º 5
0
			internal BrowseViewerForTests(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache,
				Mediator mediator, ISortItemProvider sortItemProvider, ISilDataAccessManaged sdaRecordList)
				: base(nodeSpec, hvoRoot, fakeFlid, cache, mediator, sortItemProvider, sdaRecordList)
			{
				var mainWindow = (Form)mediator.PropertyTable.GetValue("window");
				m_wnd = mainWindow as MockFwXWindow;
				m_xbv.MakeRoot(); // needed to process OnRecordNavigation
			}
Exemplo n.º 6
0
        protected override void Init()
        {
            m_entryFactory         = Cache.ServiceLocator.GetInstance <ILexEntryFactory>();
            m_senseFactory         = Cache.ServiceLocator.GetInstance <ILexSenseFactory>();
            m_exampleFactory       = Cache.ServiceLocator.GetInstance <ILexExampleSentenceFactory>();
            m_lexEntryRefFactory   = Cache.ServiceLocator.GetInstance <ILexEntryRefFactory>();
            m_lexRefTypeFactory    = Cache.ServiceLocator.GetInstance <ILexRefTypeFactory>();
            m_lexRefFactory        = Cache.ServiceLocator.GetInstance <ILexReferenceFactory>();
            m_possListFactory      = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>();
            m_revIndexFactory      = Cache.ServiceLocator.GetInstance <IReversalIndexFactory>();
            m_revIndexEntryFactory = Cache.ServiceLocator.GetInstance <IReversalIndexEntryFactory>();

            m_flidReferringSenses = Cache.MetaDataCacheAccessor.GetFieldId2(CmSemanticDomainTags.kClassId, "ReferringSenses",
                                                                            false);
            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

            UndoableUnitOfWorkHelper.Do("do", "undo", Cache.ActionHandlerAccessor,
                                        () =>
            {
                m_domainBadWords    = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>().Create();
                m_domainTemperature = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>().Create();
                Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(m_domainBadWords);
                Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(m_domainTemperature);
                m_mainDict = Cache.LangProject.LexDbOA.PublicationTypesOA.PossibilitiesOS[0];
                m_blank    = MakeEntry("blank", "swear word", true);
                m_blank.SensesOS[0].SemanticDomainsRC.Add(m_domainBadWords);
                m_hot     = MakeEntry("hot", "high temperature", false);
                m_hotTemp = m_hot.SensesOS[0];
                m_hotTemp.SemanticDomainsRC.Add(m_domainTemperature);
                m_trouble = MakeSense(m_hot, "trouble");
                m_trouble.DoNotPublishInRC.Add(m_mainDict);
                m_trouble.PicturesOS.Add(Cache.ServiceLocator.GetInstance <ICmPictureFactory>().Create());
                m_desirable = MakeSense(m_hot, "desirable");
                m_fastCar   = MakeSense(m_desirable, "fast (car)");

                m_badHot  = MakeExample(m_hotTemp, "a hot pile of blank", true);
                m_goodHot = MakeExample(m_hotTemp, "a hot bath", false);

                m_water              = MakeEntry("water", "H2O", false);
                m_waterH2O           = m_water.SensesOS[0];
                m_hotWater           = MakeEntry("hot water", "trouble", false);
                m_hotWaterComponents = MakeEntryRef(m_hotWater, new ICmObject[] { m_trouble, m_waterH2O },
                                                    new ICmObject[] { m_trouble, m_waterH2O },
                                                    LexEntryRefTags.krtComplexForm);

                m_blank2      = MakeEntry("blank", "vacant", false);
                m_blank3      = MakeEntry("blank", "erase", false);
                m_water2      = MakeEntry("water", "urinate", true);
                m_waterPrefix = MakeEntry("water", "aquatic", false);
                m_waterPrefix.LexemeFormOA.MorphTypeRA = Cache.ServiceLocator.GetInstance <IMoMorphTypeRepository>()
                                                         .GetObject(MoMorphTypeTags.kguidMorphPrefix);

                m_synonym       = MakeRefType("synonym", null, (int)LexRefTypeTags.MappingTypes.kmtSenseCollection);
                m_blip          = MakeEntry("blip", "rude word", true);
                m_bother        = MakeEntry("bother", "I'm annoyed by that", false);
                m_ouch          = MakeEntry("ouch", "that hurt", false);
                m_blipOuch      = MakeSense(m_blip.SensesOS[0], "rude ouch");
                m_blankSynonyms = MakeLexRef(m_synonym, new ICmObject[] { m_blank, m_ouch.SensesOS[0], m_blip.SensesOS[0], m_blipOuch, m_bother });

                m_problem         = MakeEntry("problem", "difficulty", false);
                m_problemSynonyms = MakeLexRef(m_synonym, new ICmObject[] { m_problem, m_trouble });

                m_body       = MakeEntry("body", "body", true);
                m_arm        = MakeEntry("arm", "arm", false);
                m_leg        = MakeEntry("leg", "leg", false);
                m_belly      = MakeEntry("belly", "belly", true);
                m_torso      = MakeEntry("torso", "torso", false);
                m_partWhole  = MakeRefType("partWhole", null, (int)LexRefTypeTags.MappingTypes.kmtEntryTree);
                m_bodyParts  = MakeLexRef(m_partWhole, new ICmObject[] { m_body, m_arm, m_leg.SensesOS[0], m_torso, m_belly });
                m_torsoParts = MakeLexRef(m_partWhole, new ICmObject[] { m_torso, m_arm, m_belly });

                m_hotBlank = MakeEntry("hotBlank", "problem rude word", false);
                MakeEntryRef(m_hotBlank, new ICmObject[] { m_trouble, m_water2 },
                             new ICmObject[] { m_trouble, m_water2 },
                             LexEntryRefTags.krtComplexForm);

                m_blueColor = MakeEntry("blue", "color blue", false);
                m_blueCold  = MakeEntry("blue", "cold", false);
                m_blueMusic = MakeEntry("blue", "jazzy", false);
                m_blueSad   = MakeEntry("blue", "sad", false);

                m_blueMusic.HomographNumber = 2;                               // will duplicate blue cold; pathological, but should not crash.
                m_blueSad.HomographNumber   = 3;                               // will conflict with renumbered blueMusic

                m_bluer             = m_blueColor.SensesOS[0];
                m_sky               = MakeEntry("sky", "interface between atmosphere and space", false, true);                   // true excludes as headword
                m_skyReal           = m_sky.SensesOS[0];
                m_blueSky           = MakeEntry("blue sky", "clear, huge potential", false);
                m_blueSkyComponents = MakeEntryRef(m_blueSky, new ICmObject[] { m_blueColor, m_skyReal },
                                                   new ICmObject[] { m_bluer, m_skyReal },
                                                   LexEntryRefTags.krtComplexForm);

                m_ringBell   = MakeEntry("ring", "bell", false);
                m_ringCircle = MakeEntry("ring", "circle", false, true);
                m_ringGold   = MakeEntry("ring", "gold", false);

                m_blackVerb  = MakeEntry("black", "darken", false, true);
                m_blackColor = MakeEntry("black", "dark", false);

                m_hotArm           = MakeEntry("hotarm", "pitcher", false);
                m_hotArmComponents = MakeEntryRef(m_hotArm, new ICmObject[] { m_hot, m_arm },
                                                  new ICmObject[] { m_hot, m_arm },
                                                  LexEntryRefTags.krtComplexForm);
                m_hotArm.DoNotPublishInRC.Add(m_mainDict);
                m_hotArmComponents.ShowComplexFormsInRS.Add(m_hot);

                m_nolanryan           = MakeEntry("Nolan_Ryan", "pitcher", false);
                m_nolanryanComponents = MakeEntryRef(m_nolanryan, new ICmObject[] { m_hot },
                                                     new ICmObject[] { m_hot },
                                                     LexEntryRefTags.krtVariant);
                m_nolanryanComponents.VariantEntryTypesRS.Add(
                    (ILexEntryType)Cache.LangProject.LexDbOA.VariantEntryTypesOA.PossibilitiesOS[0]);
                m_nolanryan.DoNotPublishInRC.Add(m_mainDict);

                m_edName   = MakeEntry("ed", "someone called ed", false);
                m_edSuffix = MakeEntry("ed", "past", false, false, true);

                m_revIndex = CreateInterestingReversalEntries();

                m_publisher = new MockPublisher((ISilDataAccessManaged)Cache.DomainDataByFlid, kmainFlid);
                m_publisher.SetOwningPropValue(Cache.LangProject.LexDbOA.Entries.Select(le => le.Hvo).ToArray());
                m_decorator = new DictionaryPublicationDecorator(Cache, m_publisher, ObjectListPublisher.OwningFlid);

                m_revPublisher = new MockPublisher((ISilDataAccessManaged)Cache.DomainDataByFlid, kmainFlid);
                m_revPublisher.SetOwningPropValue(m_revIndex.AllEntries.Select(rie => rie.Hvo).ToArray());
                m_revDecorator = new DictionaryPublicationDecorator(Cache, m_revPublisher, ObjectListPublisher.OwningFlid);
            });
        }
Exemplo n.º 7
0
			internal BulkEditBarForTests(BrowseViewer bv, XmlNode spec, Mediator mediator, FdoCache cache)
				: base(bv, spec, mediator, cache)
			{
				Form mainWindow = (Form)mediator.PropertyTable.GetValue("window") as Form;
				m_wnd = mainWindow as MockFwXWindow;
			}
Exemplo n.º 8
0
		public void CleanUp()
		{
			CheckDisposed();
			// delete property table settings.
			m_window.PropertyTable.RemoveLocalAndGlobalSettings();

			if (m_window != null && !m_window.IsDisposed)
				m_window.Dispose();
			m_bulkEditBar = null;
			m_bv = null;
			m_window = null;
			m_mediator = null;
			base.Exit();
			// overkill, but no way to directly clear individual properties.
			Cache.ClearAllData();
			if (m_fdoCache.CreateModifyManager != null)
			{
				m_fdoCache.CreateModifyManager.Dispose();
				m_fdoCache.CreateModifyManager = null;
			}
		}
Exemplo n.º 9
0
		protected virtual void InitializeNewWindow()
		{
			m_window = new MockFwXWindow();
			m_window.Init(Cache);
			// delete property table settings.
			m_window.PropertyTable.RemoveLocalAndGlobalSettings();
			ReinitializeWindow();
			ControlAssemblyReplacements();
			m_window.LoadUI(DirectoryFinder.GetFWCodeFile(@"Language Explorer\Configuration\Main.xml"));
		}
Exemplo n.º 10
0
		public override void Exit()
		{
			CheckDisposed();
			// Don't call base.Exit() since this will undo the data we set up in FixtureSetup
			//base.Exit();
			// delete property table settings.
			m_window.PropertyTable.RemoveLocalAndGlobalSettings();

			// reset our property table.
			if (m_window != null && !m_window.IsDisposed)
			{
				m_window.Dispose();
			}
			m_window = null;
			UndoLeftOverActions();
			m_mediator = null;
		}
Exemplo n.º 11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// Note: Dispose() is the TestFixtureTearDown in BaseTest class.
		///
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Undo everything.
				UndoEverythingPossible();

				// Dispose managed resources here.
				if (m_window != null)
				{
					// delete property table settings.
					m_window.PropertyTable.RemoveLocalAndGlobalSettings();
					m_window.Dispose();
				}
				if (m_locallyOwnedMediator && m_mediator != null && !m_mediator.IsDisposed)
					m_mediator.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_newBook1 = null;
			m_window = null;
			m_setupUndoCount = 0;

			base.Dispose(disposing);
		}