有沒有人有使用Google Mock與wxWidgets一起運氣?我有一個類Foo與需要常量引用wxString在簽名像這樣制定者:與谷歌模擬使用wxString
class Foo {
public:
Foo();
virtual ~Foo();
void setName(const wxString& name);
};
我然後進行嘲笑美孚這樣的:
class MockFoo : public Foo {
MOCK_METHOD1(setName, void(const wxString& name));
};
我的其他嘲弄工作得很好,但有一些關於它不喜歡的wxString參數。我編譯時看到以下內容:
C:\gmock-1.6.0\gtest\include\gtest\internal\gtest-internal.h:890: error: conversion from `const wxUniChar' to `long long int' is ambiguous
C:\wxWidgets-2.9.0\include\wx\unichar.h:74: note: candidates are: wxUniChar::operator char() const
C:\wxWidgets-2.9.0\include\wx\unichar.h:75: note: wxUniChar::operator unsigned char() const
//more potential candidates from wxUniChar follow after that
的JIST是,谷歌模擬無法確定哪個運營商()函數,因爲操作者調用由wxUniChar提供不映射到什麼谷歌預計模擬()函數。我看到'long long int'和'testing :: internal :: BiggestInt'轉換的錯誤。
對不一致。我更新了這個例子。我能夠通過向wxUniChar添加一個構造函數和各種operator =和operator()函數來修復'long long int'類型並構建wxWidgets,從而解決了我的問題。 – 2013-05-14 18:43:04