Exemplo n.º 1
0
		public void PuaCharacterToString()
		{
			string unicodeData =
				"VULGAR FRACTION ONE THIRD;No;0;ON;<fraction> 0031 2044 0033;;;1/3;N;FRACTION ONE THIRD;;;;";
			PUACharacter puaChar = new PUACharacter("2153",unicodeData);
			Assert.AreEqual("2153;" + unicodeData, puaChar.ToString(), "Error while writing PUACharacter");
		}
Exemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Assert that PUACharacter match what we expect.
		/// </summary>
		/// <param name="puaCharacterExpected">The expected PUACharacter</param>
		/// <param name="message">The message to append, e.g. "using the 'new' button"</param>
		/// <param name="wsPropsDlg">The ws props DLG.</param>
		/// ------------------------------------------------------------------------------------
		private void CheckPuaCharactersMatch(
			PUACharacter puaCharacterExpected, string message,
			DummyWritingSystemPropertiesDialog wsPropsDlg)
		{
			Assert.IsTrue(wsPropsDlg.IsPuaCodepointAdded(puaCharacterExpected.CodePoint),
				"Didn't add the PUACharacter " + puaCharacterExpected.CodePoint + " " + message);
			Assert.AreEqual(puaCharacterExpected.ToString(),
				wsPropsDlg.GetPuaString(puaCharacterExpected),
				"Didn't modify the PUACharacter " + message);
			Assert.IsTrue(wsPropsDlg.IsPuaAdded(puaCharacterExpected),
				"Didn't modify the PUACharacter " + message);
		}
Exemplo n.º 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Makes sure that if the specified codepoint is a custom PUA character, that that
		/// character is added to the language definition's PUA collection.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private static void UpdateLangDefPUACollection(int codepoint,
			LanguageDefinition langDef, List<PUACharacter> customPuaCharacters)
		{
			// Go through all the custom defined PUA characters in ICU and make sure that if
			// our codepoint is one of them, the language definition contains our codepoint
			// in its collection of PUA characters.
			foreach (PUACharacter customChar in customPuaCharacters)
			{
				string sCodePoint = codepoint.ToString("x4").ToUpperInvariant();

				// Is our codepoint one of the custom PUA characters? If so,
				// add it to the language definition's PUA collection.
				if (sCodePoint == customChar.CodePoint)
				{
					PUACharacter puaChar = new PUACharacter(sCodePoint);
					puaChar.RefreshFromIcu(false);
					langDef.AddPuaDefinition(codepoint, puaChar.ToString());
				}
			}
		}