使用 QVariant 进行单元测试

发布于 2024-11-28 19:39:59 字数 75 浏览 2 评论 0原文

我想对返回 qvariant 的函数进行单元测试,以确保 qvariant 是否持有正确的 vlaue 请给我一些想法,我应该如何进行?

I want to make a unit-test for a function returning a qvariant to make sure if the qvariant is holding the right vlaue or not
Please give me some idea to how should i proceed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

她比我温柔 2024-12-05 19:39:59

创建一个包含您期望的值的 QVariant,然后将其与返回值进行比较。为什么您认为这与测试任何其他返回类型不同?

Create a QVariant containing the value you're expecting and then compare it with the return value. Why do you think this is different to testing any other return type?

时光是把杀猪刀 2024-12-05 19:39:59

方法 QVariant::type()QVariant::typename() 应该为您提供足够的信息。

The methos QVariant::type() and QVariant::typename() should give you enough information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文