Make test for custom ToastActivatedEventArgs dataclass
DatGuy1 opened this issue · 1 comments
DatGuy1 commented
Something like this:
def test_activation_args():
from winsdk.windows.foundation import PropertyValue
from winsdk.windows.foundation.collections import ValueSet
from winsdk.windows.ui.notifications import ToastActivatedEventArgs as WinRtToastActivatedEventArgs
userInput = ValueSet()
userInput.insert("textBox", PropertyValue.create_string("World, Hello!"))
rawEventArgs = ValueSet()
rawEventArgs.insert("arguments", PropertyValue.create_string("test=yes"))
rawEventArgs.insert("user_input", userInput)
eventArgs = WinRtToastActivatedEventArgs._from(rawEventArgs)
parsedArgs = ToastActivatedEventArgs.fromWinRt(eventArgs)
assert parsedArgs.arguments == "test=yes"
assert parsedArgs.input == "World, Hello!"
Issue is I don't know what type rawEventArgs should be. The _from(rawEventArgs) statement leads to OSError: [WinError -2147467262] No such interface supported
.
DatGuy1 commented
Could be solved by pywinrt/pywinrt@d3b5541. Pending wheel release to check.