Subject: Re: bug#43252: 27.1; DBus properties lack type hints or overrides

From: Michael Albinus <[email-masked]>
Date: Fri, 11 Sep 2020 11:57:46 +0200

Hugh Daschbach <[email-masked]> writes:

Hi Hugh,

> WRT byte keyed dictionaries, I've attached a failing test.  I don't
> know if you want to look at it or not.

The failing test includes some failures itself. I've fixed them (see
appended), now it passes w/o any change in dbus.el.

> Still waiting for a response from [email-masked].  I assume a delay of
> a few days is to be expected.

Yes, it takes time. When I ran through the process decades ago,
everything was done by snail mail to and from Europe, because you have
to sign legal papers physically. Now it seems to be possible to sign
electronically, but I don't know how it goes these days.

> Thanks again,
> Hugh

Best regards, Michael.

(ert-deftest dbus-test05-register-property-types ()
  "Check property type preservation for an own service."
  (skip-unless dbus--test-enabled-session-bus)
  (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service))

  (unwind-protect
      (let ((object-array "ByteDictionary")
            (expected '((8 ("byte-eight"))
                        (16 ("/byte/sixteen"))
                        (48 ((8 9 10))))))
        (should
         (equal
          (dbus-register-property
           :session dbus--test-service dbus--test-path
           dbus--test-interface object-array :read
           '(:array
             (:dict-entry :byte 8 (:variant :string "byte-eight"))
             (:dict-entry :byte 16 (:variant :object-path "/byte/sixteen"))
             (:dict-entry :byte 48 (:variant (:array :byte 8 :byte 9 :byte 10)))))
          `((:property :session ,dbus--test-interface ,object-array)
            (,dbus--test-service ,dbus--test-path))))
        (should
         (equal
          (dbus-get-property
           :session dbus--test-service dbus--test-path
           dbus--test-interface object-array)
          expected))

        ;; A test for `dbus-get-property' shall be added.

        (let ((result
               (dbus-get-all-properties
                :session dbus--test-service dbus--test-path
                dbus--test-interface)))
          (should (equal (cdr (assoc object-array result)) expected)))

        (let ((result
               (dbus-get-all-managed-objects :session dbus--test-service "/"))
              result1)
          (should (setq result1 (cadr (assoc dbus--test-path result))))
          (should (setq result1 (cadr (assoc dbus--test-interface result1))))
          (should (equal (cdr (assoc object-array result1)) expected))))

    ;; Cleanup.
    (dbus-unregister-service :session dbus--test-service)))