Add unit tests for app path accessors

This commit is contained in:
Michael Gratton 2019-04-21 11:13:01 +10:00
parent 81bcd31b79
commit d4c29c72d7
5 changed files with 60 additions and 4 deletions

View file

@ -0,0 +1,49 @@
/*
* Copyright 2019 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
class GearyApplicationTest : TestCase {
private GearyApplication? test_article = null;
public GearyApplicationTest() {
base("GearyApplicationTest");
add_test("paths_when_installed", paths_when_installed);
}
public override void set_up() {
this.test_article = new GearyApplication();
}
public override void tear_down() {
this.test_article = null;
}
public void paths_when_installed() throws GLib.Error {
string[] args = new string[] {
_INSTALL_PREFIX + "/bin/geary",
// Specifiy this so the app doesn't actually attempt
// to start up
"-v"
};
unowned string[] unowned_args = args;
int status;
this.test_article.local_command_line(ref unowned_args, out status);
assert_string(
_INSTALL_PREFIX + "/share/geary",
this.test_article.get_resource_directory().get_path()
);
assert_string(
_INSTALL_PREFIX + "/share/applications",
this.test_article.get_desktop_directory().get_path()
);
}
}

View file

@ -5,8 +5,6 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
// Defined by CMake build script.
extern const string _BUILD_ROOT_DIR;
public abstract class ClientWebViewTestCase<V> : TestCase {

View file

@ -75,6 +75,7 @@ geary_test_client_sources = [
'engine/api/geary-credentials-mediator-mock.vala',
'client/accounts/accounts-manager-test.vala',
'client/application/geary-application-test.vala',
'client/application/geary-configuration-test.vala',
'client/components/client-web-view-test.vala',
'client/components/client-web-view-test-case.vala',

View file

@ -5,7 +5,9 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
// Defined by CMake build script.
extern const string _INSTALL_PREFIX;
extern const string _BUILD_ROOT_DIR;
extern const string _GSETTINGS_DIR;
int main(string[] args) {
@ -43,6 +45,7 @@ int main(string[] args) {
client.add_suite(new ClientWebViewTest().get_suite());
client.add_suite(new ComposerWebViewTest().get_suite());
client.add_suite(new ConfigurationTest().get_suite());
client.add_suite(new GearyApplicationTest().get_suite());
client.add_suite(new Util.Avatar.Test().get_suite());
client.add_suite(new Util.Cache.Test().get_suite());
client.add_suite(new Util.Email.Test().get_suite());