google unit test qwebview engine.



  • I setup a project with a library, main gui , and a unit test.
    I want to unit test the library functionality mainly that i am getting the right values from the qwebengineview.
    in my main gui i get the correct output in the console.
    but when in the unit test i dont get any output. i think i have a problem with the event loop.

    could you please let me know what i am doing wrong.

    #include <gtest/gtest.h>
    #include <gmock/gmock-matchers.h>
    
    #include "rotationtestlibrary.h"
    #include <QDebug>
    #include <QLibrary>
    
    using namespace testing;
    
    
    
    TEST(FirstTest, HelloWorld)
    {
        QWidget *widget = new QWidget();
        RotationTestLibrary *rl = new RotationTestLibrary(widget);
    
        // rl is getWelcome is always empty
        EXPECT_EQ(rl->getWelcome(),QString("Header"));
    
        delete widget;
    }
    
    #include "tst_rotationtest.h"
    
    #include <gtest/gtest.h>
    #include "rotationtestlibrary.h"
    #include <QApplication>
    
    
    int main(int argc, char *argv[])
    {
        ::testing::InitGoogleTest(&argc, argv);
    
        QApplication app(argc,argv);
        return RUN_ALL_TESTS();
        app.exec();
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.