在VS2012单元测试中创建和测试自定义MFC CEdit时,在第21行的afxwin1.inl中断言
Assert in afxwin1.inl on line 21 when creating and testing a custom MFC CEdit in VS2012 unit test
我的老板有一个名为CInPlaceEdit
的自定义CEdit
类,我们目前正在Visual Studio 2012中用一个单元测试项目测试这个类。基本上,我们在单元测试中创建CEdit
类,如下所示:
CDialog *dlg = new CDialog();
dlg->Create(IDD_EDIT_STRING);
CWnd *pListCtrl = dlg;
auto pParent = pListCtrl->GetParent();
auto editSpLat = new CInPlaceEdit(-1, i, pszBlank, GetEditTemplates()->m_pEdtSpLat, (void*)&m_pSP, pListCtrl, IPE_CTRL | IPE_PTRTOPTR_VAR | IPE_RIGHT_JUSTIFY, ids);
editSpLat->Create(dwStyle, CRect(0, 0, 1, 1), pListCtrl, IDC_INPLACEEDIT + i);
afxwin1.inl中第21行的assert是在调用Create(…)期间抛出的;文件afxwin1.inl中的断言是ASSERT(afxCurrentInstanceHandle != NULL)
。有没有办法让我的单元测试通过这一关?
字符集不匹配可能会导致此问题。
mfc dll
正在使用UNICODE。
请确保"IDD_EDIT_STRING"
使用的是unicode,而不是ANSI
。
也许可以尝试在字符集中使用No Set
(配置属性->常规->字符集)
相关文章:
- 将两个数组中的差异记录在第三个数组中
- 为什么将双精度转换为 int 似乎在第 16 位数字之后将其四舍五入?
- 通过比较C++中的行在 txt 文件中搜索的最简单方法是什么?
- 通过命令行在Visual Studio中编译单个独立文件
- 错误:在第 6 行'{'标记之前,此处不允许使用函数定义
- 您好,我实际上想了解以下代码.有人可以详细说明代码它到底在做什么吗?为什么它会在第 31 行崩溃
- 解决方案在第 25 行执行错误'out of bounds'
- 在C++中,如何在第一个"system()"结束后执行第二个"system()"?
- 在'在第7行
- 您好,这个简单的C 脚本在第11行中弹出了一个错误.有人知道如何修复它吗?
- 为什么在第 12 行"if(k>=max)"中给出错误说 " reference to max is ambiguous" ?
- 错误:在第8行上的“ const”之前,预期的无限制ID
- 在2D伊辛模型上工作。C++新手。我在第 23 行收到错误"expected unqualified-id before '{' token"
- 在第 16,54,55,56,57,58 行中,我收到错误"Statement missing ; in function main()"为什么?
- C++流:始终写在第 1 行
- 在VS2012单元测试中创建和测试自定义MFC CEdit时,在第21行的afxwin1.inl中断言
- 为什么我在第31行的代码中有警告
- 您的 SQL 语法错误;[...]在第 1 行的 '%+var+%' 附近 Consulta 喜欢 MYSQL
- 如何修复错误?错误:"factorial" 之前的预期";"?它在第 16 行说
- 每当启动函数 game() 时,get(c) 第一次在循环中不起作用(在第 90 行中)。