Implementation of TextClientRun based on ITsString.
Inheritance: TssClientRun
        /// <summary>
        /// Return an otherwise equivalent Tss client run that has the specified Contents.
        /// Subclasses should override to return the appropriate subclass and copy any additional information.
        /// </summary>
        internal virtual MlsClientRun CopyWithNewContents(IViewMultiString newContents)
        {
            var result = new MlsClientRun(newContents, Style);

            result.Hookup = Hookup;
            return(result);
        }
		public void MlsRuns()
		{
			string part1 = "abc def";
			IViewMultiString mls = new MultiAccessor(wsEn, wsEn);
			mls.set_String(wsEn, tsf.MakeString(part1, wsEn));
			AssembledStyles styles = new AssembledStyles();
			MlsClientRun clientRun = new MlsClientRun(mls, styles.WithWs(wsEn));
			Assert.AreEqual(1, clientRun.UniformRunCount);
			Assert.AreEqual(part1, clientRun.UniformRunText(0));
			AssembledStyles style1 = clientRun.UniformRunStyles(0);
			Assert.AreEqual(wsEn, style1.Ws);
			Assert.AreEqual(0, clientRun.UniformRunStart(0));
			Assert.AreEqual(part1.Length, clientRun.UniformRunLength(0));

			string part2 = " ghi";
			ITsStrBldr bldr = mls.get_String(wsEn).GetBldr();
			bldr.Replace(part1.Length, part1.Length, part2, ttpFrn);
			IViewMultiString multibldr = new MultiAccessor(wsEn, wsEn);
			multibldr.set_String(wsFrn, bldr.GetString());
			MlsClientRun clientRun2 = new MlsClientRun(multibldr, styles.WithWs(wsFrn));
			Assert.AreEqual(2, clientRun2.UniformRunCount);
			Assert.AreEqual(part1, clientRun2.UniformRunText(0));
			Assert.AreEqual(part2, clientRun2.UniformRunText(1));
			style1 = clientRun2.UniformRunStyles(0);
			Assert.AreEqual(wsEn, style1.Ws);
			AssembledStyles style2 = clientRun2.UniformRunStyles(1);
			Assert.AreEqual(wsFrn, style2.Ws);
			Assert.AreEqual(0, clientRun2.UniformRunStart(0));
			Assert.AreEqual(part1.Length, clientRun2.UniformRunLength(0));
			Assert.AreEqual(part1.Length, clientRun2.UniformRunStart(1));
			Assert.AreEqual(part2.Length, clientRun2.UniformRunLength(1));
		}
Exemple #3
0
		/// <summary>
		/// Return an otherwise equivalent Tss client run that has the specified Contents.
		/// Subclasses should override to return the appropriate subclass and copy any additional information.
		/// </summary>
		internal virtual MlsClientRun CopyWithNewContents(IViewMultiString newContents)
		{
			var result = new MlsClientRun(newContents, Style);
			result.Hookup = Hookup;
			return result;
		}