dotfiles/.emacs.d/conf.d/004-android.el

85 lines
2.0 KiB
EmacsLisp

(require 'android-mode)
; TODO(jwall): move this to a local config?
(setq android-mode-sdk-dir "~/android")
(defun jwall:android-ant-run-tests ()
"Run the android tests in a test directory"
(interactive)
(android-ant "run-tests"))
(defun jwall:android-activity-test-tmpl (author class-name) (concat "
/**
* Copyright (C) " (jwall:current-year) " Jeremy Wall <jeremy@marzhillstudios.com>
* All contents Licensed under the terms of the Apache License 2.0
* http://www.apache.org/licenses/LICENSE-2.0.html
*/
package " (jwall:get-current-java-ns) ";
import android.test.ActivityInstrumentationTestCase2;
import android.test.TouchUtils;
import android.test.ViewAsserts;
import android.app.Activity;
import android.view.View;
/**
* TODO:Class Description here.
*
* @author " author "
*
*/
public class " class-name "Test extends ActivityInstrumentationTestCase2<" class-name "> {
public " class-name "Test() {
super(\"" (jwall:get-current-java-ns) "\", " class-name ".class);
}
protected void setUp() throws Exception {
super.setUp();
activity = this.getActivity();
}
}
"))
(defun jwall:android-junit-test-tmpl (author class-name) (concat "
/**
* Copyright (C) " (jwall:current-year) " Jeremy Wall <jeremy@marzhillstudios.com>
* All contents Licensed under the terms of the Apache License 2.0
* http://www.apache.org/licenses/LICENSE-2.0.html
*/
package " (jwall:get-current-java-ns) ";
import junit.framework.TestCase;
/**
* TODO:Class Description here.
*
* @author " author "
*
*/
public class " class-name "Test extends TestCase {
protected void setUp() throws Exception {
super.setUp();
// TODO: autogenerated setUp method
}
}
"))
(defun jwall:fill-with-android-activity-test-class (class-name)
""
(interactive "sClassUnderTest: ")
(insert (jwall:android-activity-test-tmpl jwall:author class-name)))
(defun jwall:fill-with-android-junit-test-class (class-name)
""
(interactive "sClassUnderTest: ")
(insert (jwall:android-junit-test-tmpl jwall:author class-name)))