java guid 序列_Java Guid類代碼示例

本文整理匯總了Java中com.sun.jna.platform.win32.Guid類的典型用法代碼示例。如果您正苦於以下問題:Java Guid類的具體用法?Java Guid怎麽用?Java Guid使用的例子?那麽恭喜您, 這裏精選的類代碼示例或許可以為您提供幫助。

Guid類屬於com.sun.jna.platform.win32包,在下文中一共展示了Guid類的39個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: getSelectionContainer

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the selection container

* @return The selection container

* @throws AutomationException Something has gone wrong in automation

*/

public AutomationElement getSelectionContainer() throws AutomationException {

PointerByReference pbr = new PointerByReference();

final int res = this.getPattern().getCurrentSelectionContainer(pbr);

if (res != 0) {

throw new AutomationException(res);

}

Unknown unkConditionA = makeUnknown(pbr.getValue());

PointerByReference pUnknownA = new PointerByReference();

WinNT.HRESULT resultA = unkConditionA.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pUnknownA);

if (COMUtils.SUCCEEDED(resultA)) {

return new AutomationElement(convertPointerToElementInterface(pUnknownA));

} else {

throw new AutomationException(resultA.intValue());

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:24,

示例2: getItem

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the element associated with the grid cell

* @param x X position

* @param y Y position

* @return The Element from the grid

* @throws AutomationException Something amiss with automation

*/

public AutomationElement getItem(int x, int y) throws AutomationException {

PointerByReference cell = this.getRawItem(x, y);

Unknown uRoot = makeUnknown(cell.getValue());

PointerByReference pbr = new PointerByReference();

WinNT.HRESULT result0 = uRoot.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pbr);

if (COMUtils.SUCCEEDED(result0)) {

return new AutomationElement(convertPointerToElementInterface(pbr));

} else {

throw new AutomationException(result0.intValue());

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:23,

示例3: getExpandCollapsePatternFromItem

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the raw pattern from the given element.

* @param item The Element

* @return The raw collapse pattern

* @throws AutomationException Failed to get pattern

*/

public IUIAutomationExpandCollapsePattern getExpandCollapsePatternFromItem(AutomationElement item)

throws AutomationException {

PointerByReference pElement = item.getPattern(PatternID.ExpandCollapse.getValue());

Unknown unkConditionA = makeUnknown(pElement.getValue());

PointerByReference pUnknownA = new PointerByReference();

WinNT.HRESULT resultA = unkConditionA.QueryInterface(new Guid.REFIID(IUIAutomationExpandCollapsePattern.IID), pUnknownA);

if (COMUtils.SUCCEEDED(resultA)) {

return IUIAutomationExpandCollapsePatternConverter.PointerToInterface(pUnknownA);

} else {

throw new AutomationException("QueryInterface failed");

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:22,

示例4: test_getItem_Throws_Exception_When_Pattern_Returns_Error_From_GetItem

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

@Ignore("Need to build up the mocking")

public void test_getItem_Throws_Exception_When_Pattern_Returns_Error_From_GetItem() throws Exception {

Grid pattern = new Grid(rawPattern);

Grid spyPattern = Mockito.spy(pattern);

doAnswer(invocation -> new WinNT.HRESULT(0)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

IUIAutomationGridPattern mockGrid = Mockito.mock(IUIAutomationGridPattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

AutomationElement element = spyPattern.getItem(0,0);

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:18,

示例5: testCreateFalseCondtion

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void testCreateFalseCondtion() {

UIAutomation instance = UIAutomation.getInstance();

try {

PointerByReference condition = instance.createFalseCondition();

Unknown unk = new Unknown(condition.getValue());

PointerByReference pUnknown1 = new PointerByReference();

WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);

assertTrue("Create FalseCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));

} catch (AutomationException ex) {

assertTrue("Ouch", false);

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:19,

示例6: testCreatePropertyCondition

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void testCreatePropertyCondition() {

UIAutomation instance = UIAutomation.getInstance();

Variant.VARIANT.ByValue variant = new Variant.VARIANT.ByValue();

WTypes.BSTR sysAllocated = OleAuto.INSTANCE.SysAllocString("SOMETHING");

variant.setValue(Variant.VT_BSTR, sysAllocated);

try {

try {

PointerByReference pCondition = instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);

Unknown unk = new Unknown(pCondition.getValue());

PointerByReference pUnknown1 = new PointerByReference();

WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);

assertTrue("CreatePropertyCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));

} catch (AutomationException ex) {

assertTrue("Exception", false);

}

} finally {

OleAuto.INSTANCE.SysFreeString(sysAllocated);

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:27,

示例7: testCreateTrueCondition

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void testCreateTrueCondition() {

UIAutomation instance = UIAutomation.getInstance();

try {

PointerByReference pCondition = instance.createTrueCondition();

PointerByReference first = new PointerByReference();

// Check whether it is a condition

Unknown unk = new Unknown(pCondition.getValue());

PointerByReference pUnk = new PointerByReference();

Guid.REFIID refiid3 = new Guid.REFIID(IUIAutomationCondition.IID);

PointerByReference pUnknown1 = new PointerByReference();

WinNT.HRESULT result = unk.QueryInterface(refiid3, pUnknown1);

assertTrue("Create TrueCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));

} catch (AutomationException ex) {

assertTrue("Exception", false);

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:25,

示例8: getUnityUserPath

​點讚 3

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Nullable

private static String getUnityUserPath()

{

if(SystemInfo.isWinVistaOrNewer)

{

PointerByReference pointerByReference = new PointerByReference();

WinNT.HRESULT hresult = Shell32.INSTANCE.SHGetKnownFolderPath(Guid.GUID.fromString("{A520A1A4-1780-4FF6-BD18-167343C5AF16}"), 0, null, pointerByReference);

if(hresult.longValue() != 0)

{

return null;

}

return pointerByReference.getValue().getWideString(0) + "\\Unity";

}

else if(SystemInfo.isMac)

{

return SystemProperties.getUserHome() + "/Library/Unity";

}

else if(SystemInfo.isLinux)

{

return SystemProperties.getUserHome() + "/.config/unity3d";

}

return null;

}

開發者ID:consulo,項目名稱:consulo-unity3d,代碼行數:26,

示例9: getText

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the text from the pattern.

*

* @return The text.

* @throws AutomationException Something has gone wrong

*/

public String getText() throws AutomationException {

PointerByReference pbr = new PointerByReference();

final int res = this.getPattern().getDocumentRange(pbr);

if (res != 0) {

throw new AutomationException(res);

}

Unknown unkConditionA = makeUnknown(pbr.getValue());

PointerByReference pUnknownA = new PointerByReference();

WinNT.HRESULT resultA = unkConditionA.QueryInterface(new Guid.REFIID(IUIAutomationTextRange.IID), pUnknownA);

if (COMUtils.SUCCEEDED(resultA)) {

IUIAutomationTextRange range = convertPointerToInterface(pUnknownA);

PointerByReference sr = new PointerByReference();

final int res1 = range.getText(-1, sr);

if (res1 != 0) {

throw new AutomationException(res1);

}

return sr.getValue().getWideString(0);

} else {

throw new AutomationException(resultA.intValue());

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:34,

示例10: getAutomationElementFromReference

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Convert a raw PointerByReference to a IUIAutomationElement.

*

* @param pbr The raw pointer.

* @return The IUIAutomationElement.

* @throws AutomationException Automation library has thrown an error.

*/

public IUIAutomationElement getAutomationElementFromReference(final PointerByReference pbr)

throws AutomationException {

Unknown uElement = makeUnknown(pbr.getValue());

WinNT.HRESULT result0 = uElement.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pbr);

if (COMUtils.FAILED(result0)) {

throw new AutomationException(result0.intValue());

}

return IUIAutomationElementConverter.PointerToInterface(pbr);

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例11: getAutomationElementArrayFromReference

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Convert a raw PointerByReference to a IUIAutomationElementArray.

* @param pbr The raw pointer.

* @return The IUIAutomationElementArray.

* @throws AutomationException Automation library has thrown an error.

*/

public IUIAutomationElementArray getAutomationElementArrayFromReference(final PointerByReference pbr)

throws AutomationException {

Unknown uElement = this.makeUnknown(pbr.getValue());

PointerByReference pUnknown = new PointerByReference();

WinNT.HRESULT result0 = uElement.QueryInterface(new Guid.REFIID(IUIAutomationElementArray.IID), pUnknown);

if (COMUtils.FAILED(result0)) {

throw new AutomationException(result0.intValue());

}

return IUIAutomationElementArrayConverter.PointerToInterface(pUnknown);

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例12: collectionToList

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Turns a collection (array) of automation elements, into a collection.

*

* @param collection The ElementArray.

* @return The List.

* @throws AutomationException Error in the automation library.

*/

public List collectionToList(final IUIAutomationElementArray collection)

throws AutomationException {

IntByReference ibr = new IntByReference();

final int res = collection.getLength(ibr);

if (res != 0) {

throw new AutomationException(res);

}

List list = new ArrayList<>();

for (int count = 0; count < ibr.getValue(); count++) {

PointerByReference pbr = new PointerByReference();

final int res1 = collection.getElement(count, pbr);

if (res1 != 0) {

throw new AutomationException(res1);

}

Unknown uElement = new Unknown(pbr.getValue());

WinNT.HRESULT result0 = uElement.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pbr);

if (COMUtils.SUCCEEDED(result0)) {

IUIAutomationElement element =

IUIAutomationElementConverter.PointerToInterface(pbr);

list.add(new AutomationElement(element));

}

}

return list;

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:43,

示例13: getPointerFromElement

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the raw pointer to the element.

*

* @param element The underlying element.

* @return Pointer The raw pointer.

* @throws AutomationException An error has occurred in the automation library.

*/

protected Pointer getPointerFromElement(final IUIAutomationElement element)

throws AutomationException {

PointerByReference pElement = new PointerByReference();

WinNT.HRESULT result1 = element.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pElement);

if (!COMUtils.SUCCEEDED(result1)) {

throw new AutomationException(result1.intValue());

}

return pElement.getValue();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:19,

示例14: getElement3

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the IUIAutomationElement3 interface, if possible

* @return The IUIAutomationElement3 interface

* @throws AutomationException Not able to convert interface

*/

public final IUIAutomationElement3 getElement3() throws AutomationException {

PointerByReference pUnknown = new PointerByReference();

WinNT.HRESULT result = this.element.QueryInterface(

new Guid.REFIID(IUIAutomationElement3.IID), pUnknown);

if (COMUtils.SUCCEEDED(result)) {

return IUIAutomationElement3Converter.PointerToInterface(pUnknown);

}

throw new AutomationException("Failed to convert to IUIAutomationElement6");

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:19,

示例15: getElement6

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the IUIAutomationElement6 interface, if possible

* @return The IUIAutomationElement6 interface

* @throws AutomationException Not able to convert interface

*/

public final IUIAutomationElement6 getElement6() throws AutomationException {

PointerByReference pUnknown = new PointerByReference();

WinNT.HRESULT result = this.element.QueryInterface(

new Guid.REFIID(IUIAutomationElement6.IID), pUnknown);

if (COMUtils.SUCCEEDED(result)) {

return IUIAutomationElement6Converter.PointerToInterface(pUnknown);

}

throw new AutomationException("Failed to convert to IUIAutomationElement6");

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:19,

示例16: test_That_getPattern_Gets_Pattern_When_No_Pattern_Set

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

@Ignore("Needs better tests")

public void test_That_getPattern_Gets_Pattern_When_No_Pattern_Set() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(0)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Selection pattern = new Selection();

Selection spyPattern = Mockito.spy(pattern);

IUIAutomationSelectionPattern mockPattern = Mockito.mock(IUIAutomationSelectionPattern.class);

IUIAutomationElementArray mockArray = Mockito.mock(IUIAutomationElementArray.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

doReturn(mockPattern)

.when(spyPattern)

.convertPointerToInterface(any());

doReturn(mockArray)

.when(spyPattern)

.convertPointerToElementArray(any());

spyPattern.getCurrentSelection();

verify(spyPattern, atLeastOnce()).getCurrentSelection();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:30,

示例17: testCreateNotCondition

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void testCreateNotCondition() {

UIAutomation instance = UIAutomation.getInstance();

Variant.VARIANT.ByValue variant = new Variant.VARIANT.ByValue();

WTypes.BSTR sysAllocated = OleAuto.INSTANCE.SysAllocString("SOMETHING");

variant.setValue(Variant.VT_BSTR, sysAllocated);

try {

try {

// Create first condition to use

PointerByReference pCondition =

instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);

// Create the actual condition

PointerByReference notCondition =

instance.createNotCondition(pCondition);

// Checking

Unknown unk = new Unknown(notCondition.getValue());

PointerByReference pUnknown1 = new PointerByReference();

WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);

assertTrue("CreateNotCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));

} catch (AutomationException ex) {

assertTrue("Exception", false);

}

} finally {

OleAuto.INSTANCE.SysFreeString(sysAllocated);

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:34,

示例18: testCreateAndCondition

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void testCreateAndCondition() {

UIAutomation instance = UIAutomation.getInstance();

Variant.VARIANT.ByValue variant = new Variant.VARIANT.ByValue();

WTypes.BSTR sysAllocated = OleAuto.INSTANCE.SysAllocString("SOMETHING");

variant.setValue(Variant.VT_BSTR, sysAllocated);

try {

try {

// Create first condition to use

PointerByReference pCondition0 =

instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);

// Create first condition to use

PointerByReference pCondition1 =

instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);

// Create the actual condition

PointerByReference andCondition =

instance.createAndCondition(pCondition0, pCondition1);

// Checking

Unknown unk = new Unknown(andCondition.getValue());

PointerByReference pUnk = new PointerByReference();

PointerByReference pUnknown1 = new PointerByReference();

WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);

assertTrue("CreateAndCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));

} catch (AutomationException ex) {

assertTrue("Exception", false);

}

} finally {

OleAuto.INSTANCE.SysFreeString(sysAllocated);

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:39,

示例19: testCreateOrCondition

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void testCreateOrCondition() {

UIAutomation instance = UIAutomation.getInstance();

Variant.VARIANT.ByValue variant = new Variant.VARIANT.ByValue();

WTypes.BSTR sysAllocated = OleAuto.INSTANCE.SysAllocString("SOMETHING");

variant.setValue(Variant.VT_BSTR, sysAllocated);

try {

try {

// Create first condition to use

PointerByReference pCondition0 =

instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);

// Create first condition to use

PointerByReference pCondition1 =

instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);

// Create the actual condition

PointerByReference condition =

instance.createOrCondition(pCondition0, pCondition1);

// Checking

Unknown unk = new Unknown(condition.getValue());

PointerByReference pUnk = new PointerByReference();

PointerByReference pUnknown1 = new PointerByReference();

WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);

assertTrue("CreateOrCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));

} catch (AutomationException ex) {

assertTrue("Exception", false);

}

} finally {

OleAuto.INSTANCE.SysFreeString(sysAllocated);

}

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:39,

示例20: getRawPatternPointer

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the raw pointer to the pattern.

* @param pbr The raw pointer

* @return Result of the call from the COM library

*/

public WinNT.HRESULT getRawPatternPointer(

final PointerByReference pbr) {

Unknown uElement = makeUnknown(this.pattern);

return uElement.QueryInterface(new Guid.REFIID(this.IID), pbr);

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:11,

示例21: getSelection

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

/**

* Gets the selection.

*

* @return String of the selection

* @throws AutomationException Something has gone wrong

*/

public String getSelection() throws AutomationException {

PointerByReference pbr = new PointerByReference();

final int res = this.getPattern().getSelection(pbr);

if (res != 0) {

throw new AutomationException(res);

}

Unknown unkConditionA = makeUnknown(pbr.getValue());

PointerByReference pUnknownA = new PointerByReference();

String selectionResult = "";

WinNT.HRESULT resultA = unkConditionA.QueryInterface(new Guid.REFIID(IUIAutomationTextRangeArray.IID), pUnknownA);

if (COMUtils.SUCCEEDED(resultA)) {

IUIAutomationTextRangeArray selection =

convertPointerToArrayInterface(pUnknownA);

// OK, now what?

IntByReference ibr = new IntByReference();

final int res1 = selection.getLength(ibr);

if (res1 != 0) {

throw new AutomationException(res1);

}

int count = ibr.getValue();

for (int i = 0; i < count; i++) {

PointerByReference pbr0 = new PointerByReference();

final int res2 = selection.getElement(i, pbr0);

if (res2 != 0) {

throw new AutomationException(res2);

}

Unknown unknown = makeUnknown(pbr0.getValue());

PointerByReference pUnknown = new PointerByReference();

WinNT.HRESULT result = unknown.QueryInterface(new Guid.REFIID(IUIAutomationTextRange.IID), pUnknown);

if (COMUtils.SUCCEEDED(result)) {

IUIAutomationTextRange range =

convertPointerToInterface(pUnknown);

PointerByReference sr = new PointerByReference();

final int res3 = range.getText(-1, sr);

if (res3 != 0) {

throw new AutomationException(res3);

}

selectionResult = sr.getValue().getWideString(0);

} else {

throw new AutomationException(result.intValue());

}

}

} else {

throw new AutomationException(resultA.intValue());

}

return selectionResult;

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:68,

示例22: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Grid pattern = new Grid();

Grid spyPattern = Mockito.spy(new Grid());

IUIAutomationGridPattern mockGrid = Mockito.mock(IUIAutomationGridPattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

spyPattern.getItem(0,0);

verify(mockGrid, atLeastOnce()).getItem(any(), any(),any());

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例23: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Toggle pattern = new Toggle();

Toggle spyPattern = Mockito.spy(new Toggle());

IUIAutomationTogglePattern mockRange = Mockito.mock(IUIAutomationTogglePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

spyPattern.toggle();

verify(spyPattern, atLeastOnce()).toggle();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例24: test_That_getPattern_Gets_Pattern_When_No_Pattern_Set

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void test_That_getPattern_Gets_Pattern_When_No_Pattern_Set() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Toggle pattern = new Toggle();

Toggle spyPattern = Mockito.spy(new Toggle());

IUIAutomationTogglePattern mockRange = Mockito.mock(IUIAutomationTogglePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

doReturn(mockRange)

.when(spyPattern)

.convertPointerToInterface(any());

spyPattern.toggle();

verify(spyPattern, atLeastOnce()).toggle();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:24,

示例25: test_GetSelection_Throws_Exception_When_GetRange_Length_Fails

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_GetSelection_Throws_Exception_When_GetRange_Length_Fails() throws Exception {

doAnswer(invocation -> 0).when(rawPattern).getSelection(any());

doAnswer(invocation -> new WinNT.HRESULT(0)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Text pattern = new Text(rawPattern);

Text spyPattern = Mockito.spy(new Text(rawPattern));

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

IUIAutomationTextRangeArray mockRangeArray = Mockito.mock(IUIAutomationTextRangeArray.class);

doAnswer(invocation -> 1).when(mockRangeArray).getLength(any());

doReturn(mockRangeArray)

.when(spyPattern)

.convertPointerToArrayInterface(any());

String text = spyPattern.getSelection();

assertTrue(text.equals(""));

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:27,

示例26: test_GetText_Throws_Exception_When_QueryInterface_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_GetText_Throws_Exception_When_QueryInterface_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Text pattern = new Text(rawPattern);

Text spyPattern = Mockito.spy(new Text(rawPattern));

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

IUIAutomationTextRange mockRange = Mockito.mock(IUIAutomationTextRange.class);

String text = spyPattern.getText();

assertTrue(text.equals(""));

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例27: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Table pattern = new Table();

Table spyPattern = Mockito.spy(pattern);

IUIAutomationTablePattern mockRange = Mockito.mock(IUIAutomationTablePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

spyPattern.getRowOrColumnMajor();

verify(mockRange, atLeastOnce()).getCurrentRowOrColumnMajor(any());

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例28: test_That_getPattern_Gets_Pattern_When_No_Pattern_Set

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void test_That_getPattern_Gets_Pattern_When_No_Pattern_Set() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Table pattern = new Table();

Table spyPattern = Mockito.spy(pattern);

IUIAutomationTablePattern mockRange = Mockito.mock(IUIAutomationTablePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

doReturn(mockRange)

.when(spyPattern)

.convertPointerToInterface(any());

spyPattern.getRowOrColumnMajor();

verify(mockRange, atLeastOnce()).getCurrentRowOrColumnMajor(any());

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:24,

示例29: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Selection pattern = new Selection();

Selection spyPattern = Mockito.spy(pattern);

IUIAutomationSelectionPattern mockPattern = Mockito.mock(IUIAutomationSelectionPattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

spyPattern.getCurrentSelection();

verify(spyPattern, atLeastOnce()).getCurrentSelection();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例30: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

@Ignore("Throws Mockito exception")

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Value pattern = new Value();

Value spyPattern = Mockito.spy(pattern);

IUIAutomationValuePattern mockPattern = Mockito.mock(IUIAutomationValuePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any(Pointer.class));

doReturn(mockPattern)

.when(spyPattern)

.convertPointerToInterface(any(PointerByReference.class));

spyPattern.value();

verify(mockPattern, atLeastOnce()).getValue(any());

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:25,

示例31: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Range pattern = new Range();

Range spyPattern = Mockito.spy(new Range());

IUIAutomationRangeValuePattern mockRange = Mockito.mock(IUIAutomationRangeValuePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

spyPattern.getValue();

verify(mockRange, atLeastOnce()).getValue(any());

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例32: test_That_getPattern_Gets_Pattern_When_No_Pattern_Set

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void test_That_getPattern_Gets_Pattern_When_No_Pattern_Set() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Range pattern = new Range();

Range spyPattern = Mockito.spy(new Range());

IUIAutomationRangeValuePattern mockRange = Mockito.mock(IUIAutomationRangeValuePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

doReturn(mockRange)

.when(spyPattern)

.convertPointerToInterface(any());

spyPattern.getValue();

verify(mockRange, atLeastOnce()).getValue(any());

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:24,

示例33: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Styles pattern = new Styles();

Styles spyPattern = Mockito.spy(pattern);

IUIAutomationStylesPattern mockPattern = Mockito.mock(IUIAutomationStylesPattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

spyPattern.getStyleName();

verify(spyPattern, atLeastOnce()).getStyleName();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例34: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Invoke pattern = new Invoke();

Invoke spyPattern = Mockito.spy(new Invoke());

IUIAutomationInvokePattern mockRange = Mockito.mock(IUIAutomationInvokePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

spyPattern.invoke();

verify(mockRange, atLeastOnce()).invoke();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:20,

示例35: test_That_getPattern_Gets_Pattern_When_No_Pattern_Set

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

public void test_That_getPattern_Gets_Pattern_When_No_Pattern_Set() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Invoke pattern = new Invoke();

Invoke spyPattern = Mockito.spy(new Invoke());

IUIAutomationInvokePattern mockRange = Mockito.mock(IUIAutomationInvokePattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

doReturn(mockRange)

.when(spyPattern)

.convertPointerToInterface(any());

spyPattern.invoke();

verify(mockRange, atLeastOnce()).invoke();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:24,

示例36: test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

@Ignore("Fails after mockito upgrade")

public void test_That_getPattern_Throws_Exception_When_Pattern_Returns_Error() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

SelectionItem pattern = new SelectionItem();

SelectionItem spyPattern = Mockito.spy(pattern);

IUIAutomationSelectionItemPattern mockPattern = Mockito.mock(IUIAutomationSelectionItemPattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any(Pointer.class));

doReturn(mockPattern)

.when(spyPattern)

.convertPointerToInterface(any(PointerByReference.class));

spyPattern.select();

verify(spyPattern, atLeastOnce()).select();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:25,

示例37: test_getCurrentSelection

​點讚 2

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

@Ignore("Needs better tests")

public void test_getCurrentSelection() throws Exception {

doAnswer(invocation -> 0).when(rawPattern).getCurrentSelection(any());

doAnswer(invocation -> new WinNT.HRESULT(0)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Selection pattern = new Selection(rawPattern);

Selection spyPattern = Mockito.spy(new Selection(rawPattern));

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

IUIAutomationElementArray mockArray = Mockito.mock(IUIAutomationElementArray.class);

doReturn(mockArray)

.when(spyPattern)

.convertPointerToElementArray(any());

spyPattern.getCurrentSelection();

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:25,

示例38: test_That_getPattern_Gets_Pattern_When_No_Pattern_Set

​點讚 1

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test

@Ignore("Mocking issues, need to be sorted")

public void test_That_getPattern_Gets_Pattern_When_No_Pattern_Set() throws Exception {

doAnswer(invocation -> new WinNT.HRESULT(0)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Grid pattern = new Grid();

Grid spyPattern = Mockito.spy(new Grid());

IUIAutomationGridPattern mockGrid = Mockito.mock(IUIAutomationGridPattern.class);

doReturn(mockUnknown)

.when(spyPattern)

.makeUnknown(any());

doReturn(mockGrid)

.when(spyPattern)

.convertPointerToInterface(any());

IUIAutomationElement mockElement = Mockito.mock(IUIAutomationElement.class);

doReturn(mockElement)

.when(spyPattern)

.convertPointerToElementInterface(any());

spyPattern.getItem(0,0);

verify(mockGrid, atLeastOnce()).getItem(any(), any(),any());

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:31,

示例39: test_GetSelection_Throws_Exception_When_Error_Returned

​點讚 1

import com.sun.jna.platform.win32.Guid; //導入依賴的package包/類

@Test(expected=AutomationException.class)

@Ignore("Failures after Mockito upgrade")

public void test_GetSelection_Throws_Exception_When_Error_Returned() throws Exception {

doAnswer(invocation -> 0).when(rawPattern).getSelection(any(PointerByReference.class));

doAnswer(invocation -> new WinNT.HRESULT(-1)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));

Text pattern = new Text(rawPattern);

String text = pattern.getSelection();

assertTrue(text.equals(""));

}

開發者ID:mmarquee,項目名稱:ui-automation,代碼行數:14,

注:本文中的com.sun.jna.platform.win32.Guid類示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值