Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How could I output variable's value on QtTest.

How could I output variable's value on QtTest.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jiancaiyangJ Offline
    jiancaiyangJ Offline
    jiancaiyang
    wrote on last edited by
    #1

    I make a simple test for our module:

    #include <QTest>
    #include <QDebug>
    #include <MMDModel>
    
    class tst_MMDModel: public MMDModel
    {
        Q_OBJECT
    public:
    private Q_SLOTS:
        void loadValidSource( void )
        {
            QString file( __FILE__ );
            file.append( "/hatsunemiku/hatsunemiku_ver2.pmd" );
            setSource( file );
            //QVERIFY( errorString( ) == "" );
            qWarning( ) << errorString( );
            QCOMPARE( errorString( ), QString( "" ) );
        }
    };
    
    QTEST_APPLESS_MAIN( tst_MMDModel )
    #include "tst_mmdmodel.moc"
    

    Actually I want to show errorString( ) in output panel, how could I achieve this?

    我们自己的论坛:http://qtdream.com
    擅长三维角色仿真动画。

    jsulmJ 1 Reply Last reply
    0
    • jiancaiyangJ jiancaiyang

      I make a simple test for our module:

      #include <QTest>
      #include <QDebug>
      #include <MMDModel>
      
      class tst_MMDModel: public MMDModel
      {
          Q_OBJECT
      public:
      private Q_SLOTS:
          void loadValidSource( void )
          {
              QString file( __FILE__ );
              file.append( "/hatsunemiku/hatsunemiku_ver2.pmd" );
              setSource( file );
              //QVERIFY( errorString( ) == "" );
              qWarning( ) << errorString( );
              QCOMPARE( errorString( ), QString( "" ) );
          }
      };
      
      QTEST_APPLESS_MAIN( tst_MMDModel )
      #include "tst_mmdmodel.moc"
      

      Actually I want to show errorString( ) in output panel, how could I achieve this?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @jiancaiyang said in How could I output variable's value on QtTest.:

      qWarning( ) << errorString( );

      You're already doing it. It doesn't work?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      jiancaiyangJ 1 Reply Last reply
      1
      • jsulmJ jsulm

        @jiancaiyang said in How could I output variable's value on QtTest.:

        qWarning( ) << errorString( );

        You're already doing it. It doesn't work?

        jiancaiyangJ Offline
        jiancaiyangJ Offline
        jiancaiyang
        wrote on last edited by
        #3

        @jsulm I found QWARN macro works, other like "qDebug", "qWarning" does not work.

        我们自己的论坛:http://qtdream.com
        擅长三维角色仿真动画。

        jsulmJ 1 Reply Last reply
        0
        • jiancaiyangJ jiancaiyang

          @jsulm I found QWARN macro works, other like "qDebug", "qWarning" does not work.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @jiancaiyang Do you mean it doesn't print anything, or it doesn't compile?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          jiancaiyangJ 1 Reply Last reply
          0
          • jsulmJ jsulm

            @jiancaiyang Do you mean it doesn't print anything, or it doesn't compile?

            jiancaiyangJ Offline
            jiancaiyangJ Offline
            jiancaiyang
            wrote on last edited by
            #5

            @jsulm It does'nt print anything.

            我们自己的论坛:http://qtdream.com
            擅长三维角色仿真动画。

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              What if you use qDebug("Print me"); ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved