forked from enthought/comtypes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix old index bug in
call_with_inout
(enthought#473)
* bugfix in `call_with_inout` * minor cleanup * handling the case of no in and no out * Test case for _fix_inout_args * additional cleanup and error handling * code formatting fixed * fix python 3.7 and 3.8 compatibility * Temporary addition of real-world test * code cleanup * intermediate commit, do not review * Refactor of unit test, removing portdevice test * fix global side-effect of other skipped test * Update comtypes/test/test_outparam.py Co-authored-by: Jun Komoda <[email protected]> * work on tests for inout_args and outparam - cleanup for test_outparam.py - improvements to test_inout_args.py - comments on a possible error in _memberspec.py * removing dead code * rename variables and add assertions * pass `MagicMock` instead of `ut.TestCase` * make tests for each argument passing patterns * remove duplicated comments * update test code for readability - remove name from mock - move line breaks to between mock preparations and assertions * split the testcases * add `Test_Error` * minor corrections, remove redundancy, migration - rewrite the permutations test - missing direction and omitted name redundant - migrate autogenerated keywords - TBD: more real life tests * Add tests covering 24 patterns - instead of using `if` statements and `permutations` * update test name * add real world tests, remove old code * formatting issue * Update comtypes/_memberspec.py dict type annotation Co-authored-by: Jun Komoda <[email protected]> * Change missing 'in' or 'out' to be treated as 'in' * Add real-world test: param without 'in' or 'out' * add `contextlib.redirect_stdout` to supress warnings * apply review feedback * update comments * add line breaks to lines longer than 88 characters * Update comtypes/test/test_inout_args.py --------- Co-authored-by: jonschz <[email protected]> Co-authored-by: Jonathan <[email protected]> Co-authored-by: Jun Komoda <[email protected]> (cherry picked from commit 876801f)
- Loading branch information
Showing
4 changed files
with
584 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import contextlib | ||
import unittest as ut | ||
|
||
from ctypes import POINTER, pointer, windll | ||
from comtypes import GUID | ||
import comtypes.client | ||
|
||
|
||
class Test_IMFAttributes(ut.TestCase): | ||
def test_imfattributes(self): | ||
with contextlib.redirect_stdout(None): # supress warnings, see test_client.py | ||
comtypes.client.GetModule("msvidctl.dll") | ||
from comtypes.gen import MSVidCtlLib | ||
|
||
imf_attrs = POINTER(MSVidCtlLib.IMFAttributes)() | ||
hres = windll.mfplat.MFCreateAttributes(pointer(imf_attrs), 2) | ||
self.assertEqual(hres, 0) | ||
|
||
MF_TRANSCODE_ADJUST_PROFILE = GUID("{9c37c21b-060f-487c-a690-80d7f50d1c72}") | ||
set_int_value = 1 | ||
# IMFAttributes.SetUINT32() is an example of a function that has a parameter | ||
# without an `in` or `out` direction; see also test_inout_args.py | ||
imf_attrs.SetUINT32(MF_TRANSCODE_ADJUST_PROFILE, set_int_value) | ||
get_int_value = imf_attrs.GetUINT32(MF_TRANSCODE_ADJUST_PROFILE) | ||
self.assertEqual(set_int_value, get_int_value) | ||
|
||
|
||
if __name__ == "__main__": | ||
ut.main() |
Oops, something went wrong.