auto-complete / popup-el

Visual Popup Interface Library for Emacs
GNU General Public License v3.0
446 stars 96 forks source link

Apply the patch of #8 to current popup-el. #74

Closed kenbeese closed 9 years ago

kenbeese commented 10 years ago

I applied the patch of #8 to current popup-el. However, I tested it with only emacs24.3, because I have only emacs24.3. Should I test with emacs23 as mentioned in #8?

kenbeese commented 10 years ago

In my environment, make test and make test-nw are passed. However, make travis-ci is not passed. I think it is due to --batch option.

syohex commented 10 years ago

Would you rebase ?

kenbeese commented 10 years ago

I rebased.

kenbeese commented 10 years ago

posn-at-point function returns nil with --batch option, because there is no window. This is why the test is failed. I have no idea how to fix, since the function plays an important role in this patch.

syohex commented 10 years ago

How about emulating posn-at-point by cl-letf ?

kenbeese commented 10 years ago

Do you mean that posn-at-point is emulated in --batch test or emulated function used only in no-window environment?

syohex commented 10 years ago

すいません, 質問の意図が把握しきれないんですが, テストのときは, cl-letf等で posn-at-pointは期待する値を返すという関数で置き換えるという 話です. エミュレートという言葉を使ったのは悪かったかもしれません.

kenbeese commented 10 years ago

了解しました。 テストの修正をしてみます。 いえ、私の英語が拙く、申し訳ありません。

syohex commented 10 years ago

あと大掛かりな変更なので, テストも追加していただけると嬉しいです. こんなテストが必要だ, 等の提案でも構わないので何かありましたらお願いします.

kenbeese commented 10 years ago

とりあえず、batch処理の時のみ、posn-at-pointとセットで使っているposn-col-rowcl-letfで置き変えて、テストが通りました。

batch用に作成できるか分かりませんが、invisible用のテストは以下の2つが必要なのではないかと考えています。

  1. popupが見える位置にちゃんと出ているかどうか
  2. popupを終了した後にinvisible propertyの設定が正しくされているかどうか
kenbeese commented 10 years ago

invisibleなoverlay上にpopupする最小のコードと、これに準拠したテストを以下のように作成しました。 しかし、popup-test-helper-buffer-contentsによってうまくbufferに表示されている内容を取得で きなく、うまいことテスト出来ませんでした。

popupのoverlayがあり、なおかつ、invisibleなoverlayがある時のbufferに表示されている内容をうまく取得するhelper関数を作成しないと駄目そうです。ただ、どうやってそのhelper関数を作ったらいいかわかりません。何かいい案やもっと違うテストをした方がいい等あれば、指摘して頂けると幸いです。

;;; popup on invisible text
(progn
  (goto-char (point-min))
  (save-excursion (insert "123456789abcdefg"))
  (setq ov (make-overlay 1 17))
  (overlay-put ov 'invisible t)
  (setq popup (popup-create (point) 10 10))
  (popup-set-list popup (split-string "FOO\nBAR\nFoo\nBar"))
  (popup-draw popup)
  )
(ert-deftest popup-test-invisible-text ()
  (popup-test-with-common-setup
   (save-excursion (insert "123456789abcdefg"))
   (overlay-put (make-overlay 1 17) 'invisible t)
   (popup-test-helper-create-popup "\
foo
bar
baz
bar")
   (should (popup-test-helper-rectangle-match "\
foo
bar
baz
bar"))))
mbrgm commented 9 years ago

Is there any progress on this PR?