Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26007

Add an option to visualise "invalid" characters

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Editors
    • Labels:
      None

      Description

      OK, "invalid" is a bit vague but hear me out. The following CMake code

      # Collect test data
      file(GLOB_RECURSE test_data_glob
          RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
          ${CMAKE_CURRENT_SOURCE_DIR}/../data/tst_*)
      list(APPEND test_data ${test_data_glob})
      list(FILTER test_data EXCLUDE REGEX "(\
      .*tst_abstractbutton\\.qml|\
      .*tst_action\\.qml|\
      .*tst_actiongroup\\.qml|\
      .*tst_applicationwindow\\.qml|\
      .*tst_busyindicator\\.qml|\
      .*tst_buttongroup\\.qml|\
      .*tst_checkdelegate\\.qml|\
      .*tst_container\\.qml|\
      .*tst_control\\.qml|\
      .*tst_delaybutton\\.qml|\
      .*tst_dial\\.qml|\
      .*tst_dialog\\.qml|\
      .*tst_dialogbuttonbox\\.qml|\
      .*tst_drawer\\.qml|\
      .*tst_horizontalheaderview\\.qml|\
      .*tst_itemdelegate\\.qml|\
      .*tst_label\\.qml|\
      .*tst_menu\\.qml|\
      .*tst_menubar\\.qml|\
      .*tst_menubaritem\\.qml|\
      .*tst_menuitem\\.qml|\
      .*tst_menuseparator\\.qml|\
      .*tst_page\\.qml|\
      .*tst_pageindicator\\.qml|\
      .*tst_pane\\.qml|\
      .*tst_popup\\.qml|\
      .*tst_radiodelegate\\.qml|\
      .*tst_rangeslider\\.qml|\
      .*tst_roundbutton\\.qml|\
      .*tst_scrollindicator\\.qml|\
      .*tst_selectionrectangle\\.qml|\
      .*tst_splitview\\.qml|\
      .*tst_stackview\\.qml|\
      .*tst_swipedelegate\\.qml|\
      .*tst_swipeview\\.qml|\
      .*tst_switch\\.qml|\
      .*tst_switchdelegate\\.qml|\
      .*tst_tabbar\\.qml|\
      .*tst_tabbutton\\.qml|\
      .*tst_toolbar\\.qml|\
      .*tst_toolbutton\\.qml|\
      .*tst_toolseparator\\.qml|\
      .*tst_tooltip\\.qml|\
      .*tst_tumbler\\.qml|\
      .*tst_verticalheaderview\\.qml\
      )")
      set(test_data_dir "${CMAKE_CURRENT_BINARY_DIR}/data")
      # TODO: workaround for QTBUG-94961; remove when fixed.
      # It copies the test files to a separate directory (in the build dir)
      # and passes this directory to the test binary.
      file(MAKE_DIRECTORY "${test_data_dir}")
      foreach(qml_test_file IN LISTS test_data)
          file(CREATE_LINK "${​​​​​​​CMAKE_CURRENT_SOURCE_DIR}​​​​​​​/${​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​" "${​​​​​​​​​​​​​​​test_data_dir}​​​​​​​​​​​​​​​/${​​​​​​​​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​" COPY_ON_ERROR)
      endforeach()
      
      qt_internal_add_test(tst_windows
          GUI
          QMLTEST
          SOURCES
              tst_windows.cpp
          DEFINES
              TST_CONTROLS_DATA=\\\"${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/auto/controls/data\\\"
          PUBLIC_LIBRARIES
              Qt::Gui
              Qt::QuickControls2
          TESTDATA ${test_data}
      )
      

      results in this error

      CMake Error at tests/auto/controls/windows/CMakeLists.txt:59 (file):
        Syntax error in cmake code at
      
          C:/dev/qt-dev/qtquickcontrols2/tests/auto/controls/windows/CMakeLists.txt:59
      
        when parsing string
      
          ${​​​​​​​CMAKE_CURRENT_SOURCE_DIR}​​​​​​​/${​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​
      
        Invalid character ('�') in a variable name: ''
      
      
      CMake Error at tests/auto/controls/windows/CMakeLists.txt:59 (file):
        Syntax error in cmake code at
      
          C:/dev/qt-dev/qtquickcontrols2/tests/auto/controls/windows/CMakeLists.txt:59
      
        when parsing string
      
          ${​​​​​​​​​​​​​​​test_data_dir}​​​​​​​​​​​​​​​/${​​​​​​​​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​
      
        Invalid character ('�') in a variable name: ''
      
      
      -- Configuring incomplete, errors occurred!
      

      Now this is pretty straightforward to fix: remove the line and type it out manually. But wouldn't it be better if Creator had a way of pointing out invalid characters for the file format? "Visualise whitespace" doesn't help here, unfortunately.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            davschul David Schulz
            Reporter:
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes