Geary.ImapDb.SearchQuery: Rename to Geary.FtsSearchQuery

There's nothing IMAP-specific about the class, so move it to common
and rename to reflect what it is actually used for.
This commit is contained in:
Michael Gratton 2020-11-05 00:21:39 +11:00 committed by Michael James Gratton
parent 2ab7b2c39e
commit 20a4fd3ed2
8 changed files with 27 additions and 24 deletions

View file

@ -5,17 +5,17 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
public class Geary.ImapDB.SearchQueryTest : TestCase {
public class Geary.FtsSearchQueryTest : TestCase {
private GLib.File? tmp_dir = null;
private Geary.AccountInformation? config = null;
private Account? account = null;
private ImapDB.Account? account = null;
private SnowBall.Stemmer? stemmer = null;
public SearchQueryTest() {
base("Geary.ImapDB.SearchQueryTest");
public FtsSearchQueryTest() {
base("Geary.FtsSearchQueryTest");
add_test("email_text_terms", email_text_terms);
add_test("email_text_terms_stemmed", email_text_terms_stemmed);
add_test("email_text_terms_specific", email_text_terms_specific);
@ -25,7 +25,7 @@ public class Geary.ImapDB.SearchQueryTest : TestCase {
public override void set_up() throws GLib.Error {
this.tmp_dir = GLib.File.new_for_path(
GLib.DirUtils.make_tmp("geary-imap-db-search-query-test-XXXXXX")
GLib.DirUtils.make_tmp("geary-common-fts-search-query-test-XXXXXX")
);
this.config = new Geary.AccountInformation(
@ -35,7 +35,7 @@ public class Geary.ImapDB.SearchQueryTest : TestCase {
new Geary.RFC822.MailboxAddress(null, "test@example.com")
);
this.account = new Account(
this.account = new ImapDB.Account(
config,
this.tmp_dir,
GLib.File.new_for_path(_SOURCE_ROOT_DIR).get_child("sql")
@ -212,16 +212,17 @@ public class Geary.ImapDB.SearchQueryTest : TestCase {
search_with_both.exec(null);
}
private SearchQuery new_search_query(Geary.SearchQuery.Term[] ops, string raw)
private FtsSearchQuery new_search_query(Geary.SearchQuery.Term[] ops,
string raw)
throws GLib.Error {
return new SearchQuery(
return new FtsSearchQuery(
new Gee.ArrayList<Geary.SearchQuery.Term>.wrap(ops),
raw,
this.stemmer
);
}
private void assert_queries(SearchQuery query) throws GLib.Error {
private void assert_queries(FtsSearchQuery query) throws GLib.Error {
var search = query.get_search_query(
this.account.db.get_primary_connection(),
null,

View file

@ -36,6 +36,7 @@ test_engine_sources = [
'engine/app/app-conversation-set-test.vala',
'engine/common/common-contact-store-impl-test.vala',
'engine/common/common-contact-harvester-test.vala',
'engine/common/common-fts-search-query-test.vala',
'engine/db/db-database-test.vala',
'engine/db/db-versioned-database-test.vala',
'engine/imap/command/imap-create-command-test.vala',
@ -53,7 +54,6 @@ test_engine_sources = [
'engine/imap-db/imap-db-database-test.vala',
'engine/imap-db/imap-db-email-identifier-test.vala',
'engine/imap-db/imap-db-folder-test.vala',
'engine/imap-db/imap-db-search-query-test.vala',
'engine/imap-engine/account-processor-test.vala',
'engine/imap-engine/imap-engine-generic-account-test.vala',
'engine/mime/mime-content-type-test.vala',

View file

@ -72,7 +72,9 @@ int main(string[] args) {
engine.add_suite(new Geary.ImapDB.DatabaseTest().suite);
engine.add_suite(new Geary.ImapDB.EmailIdentifierTest().suite);
engine.add_suite(new Geary.ImapDB.FolderTest().suite);
engine.add_suite(new Geary.ImapDB.SearchQueryTest().suite);
// Depends on ImapDB working
engine.add_suite(new Geary.FtsSearchQueryTest().suite);
engine.add_suite(new Geary.ImapEngine.AccountProcessorTest().suite);
engine.add_suite(new Geary.ImapEngine.GenericAccountTest().suite);