[folks] core: Replace symbols with spaces when matching names in PotentialMatch
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Replace symbols with spaces when matching names in PotentialMatch
- Date: Mon, 25 Jun 2012 21:49:44 +0000 (UTC)
commit 2341b9772bfba76ff153d3b36aa88cb3409e8681
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Jun 25 20:07:21 2012 +0100
core: Replace symbols with spaces when matching names in PotentialMatch
This allows, for example, âAlice Badgerâ and âalice.badgerâ to have a HIGH
match. This is a common situation when trying to pair up IM personas with
other personas.
This also includes a test case.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=678474
folks/potential-match.vala | 17 ++++++++++-------
tests/tracker/match-name.vala | 9 +++++++++
2 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/folks/potential-match.vala b/folks/potential-match.vala
index ee8e3fb..aab3341 100644
--- a/folks/potential-match.vala
+++ b/folks/potential-match.vala
@@ -545,13 +545,6 @@ public class Folks.PotentialMatch : Object
case UnicodeType.ENCLOSING_MARK:
/* Ignore those */
break;
- case UnicodeType.PRIVATE_USE:
- case UnicodeType.SURROGATE:
- case UnicodeType.LOWERCASE_LETTER:
- case UnicodeType.MODIFIER_LETTER:
- case UnicodeType.OTHER_LETTER:
- case UnicodeType.TITLECASE_LETTER:
- case UnicodeType.UPPERCASE_LETTER:
case UnicodeType.DECIMAL_NUMBER:
case UnicodeType.LETTER_NUMBER:
case UnicodeType.OTHER_NUMBER:
@@ -569,6 +562,16 @@ public class Folks.PotentialMatch : Object
case UnicodeType.LINE_SEPARATOR:
case UnicodeType.PARAGRAPH_SEPARATOR:
case UnicodeType.SPACE_SEPARATOR:
+ /* Replace punctuation with spaces. */
+ retval[0] = ' ';
+ break;
+ case UnicodeType.PRIVATE_USE:
+ case UnicodeType.SURROGATE:
+ case UnicodeType.LOWERCASE_LETTER:
+ case UnicodeType.MODIFIER_LETTER:
+ case UnicodeType.OTHER_LETTER:
+ case UnicodeType.TITLECASE_LETTER:
+ case UnicodeType.UPPERCASE_LETTER:
default:
ch = ch.tolower ();
ch.fully_decompose (false, retval);
diff --git a/tests/tracker/match-name.vala b/tests/tracker/match-name.vala
index ec96eff..dbf2364 100644
--- a/tests/tracker/match-name.vala
+++ b/tests/tracker/match-name.vala
@@ -52,6 +52,8 @@ public class MatchNameTests : Folks.TestCase
this.test_match_name_4);
this.add_test ("test potential match by name #5 ",
this.test_match_name_5);
+ this.add_test ("test potential match by name #6 ",
+ this.test_match_name_6);
}
public override void set_up ()
@@ -119,6 +121,13 @@ public class MatchNameTests : Folks.TestCase
assert (this._match >= Folks.MatchResult.HIGH);
}
+ public void test_match_name_6 ()
+ {
+ /* Another one from bgo#678474, testing random punctuation in names */
+ this._test_match_name ("Alice Badger", "alice.badger");
+ assert (this._match >= Folks.MatchResult.HIGH);
+ }
+
private async void _test_match_name_async ()
{
var store = BackendStore.dup ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]