viewtopic.php?f=1&t=49662
But I'm getting stuck in text editing with the simulator now.
Here is an example.
Code: Select all
// main.cpp
#include <gtest/gtest.h>
#include "wx/wx.h"
#include "wx/app.h"
#include "wx/uiaction.h"
class MyApp: public wxApp{
public:
wxFrame* m_frame;
bool OnInit() {
m_frame = new wxFrame(nullptr, wxID_ANY, "test");
m_frame->Show();
return true;
}
};
int main(int argc, char ** argv)
{
::testing::InitGoogleTest(&argc, argv);
MyApp* app = new MyApp();
wxEntryStart(argc, argv);
app->OnInit();
return RUN_ALL_TESTS();
}
TEST(SomeTests, test1) {
wxTextCtrl* text = new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
text->SetFocus();
wxUIActionSimulator sim;
sim.Text("test");
wxYield();
EXPECT_STREQ("test", text->GetValue());
}
Code: Select all
error: Expected equality of these values:
"test"
text->GetValue()
Which is: ""
How can I edit wxTextCtrl with the simulator?
I'm using Windows10, MSVC 19.31, and wxWidgets 3.1.5.
Thanks in advance.