diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2022-06-20 16:10:26 +0200 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2022-06-24 13:55:22 +0200 |
| commit | 1815221245c0c0e8e437b46975357a282b3ad9b3 (patch) | |
| tree | bb86098c2ef11d47c6b0bc1f97f12cee55cc2ba9 /tools/snippets_translate/tests | |
| parent | f8e945097c4639df5d1263dbca81e2c4fcc371b5 (diff) | |
snippet_translate double colon improvements
- Earlier, double colons were converted to dot operator only when the
statement had a QObject class or namespace. For cases with a normal C++
namespace like MyClass::x, it was still translated without modifications
to Python.
- This patch adds an extra statement at the end of snippet_translate(x)
to convert all the remaining scope resolution to dot operator
On top of the above changes, it also addresses a FIXME to handle C++
iterator declaration in Python
Task-number: PYSIDE-1972
Pick-to: 6.3
Change-Id: I45d12954835aaa569d1a4ef15badb366eaff0fe7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'tools/snippets_translate/tests')
| -rw-r--r-- | tools/snippets_translate/tests/test_converter.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/snippets_translate/tests/test_converter.py b/tools/snippets_translate/tests/test_converter.py index e681fed6c..17ab0b449 100644 --- a/tools/snippets_translate/tests/test_converter.py +++ b/tools/snippets_translate/tests/test_converter.py @@ -95,8 +95,12 @@ def test_cast(): def test_double_colon(): assert st("Qt::Align") == "Qt.Align" assert st('QSound::play("mysounds/bells.wav");') == 'QSound.play("mysounds/bells.wav")' - # FIXME - assert st("Widget::method") == "Widget::method" + assert st("Widget::method") == "Widget.method" + + # multiline statement connect statement + # eg: connect(reply, &QNetworkReply::errorOccurred, + # this, &MyClass::slotError); + assert st("this, &MyClass::slotError);") == "self, MyClass.slotError)" def test_cout_endl(): @@ -375,6 +379,8 @@ def test_special_cases(): assert st("public:") == "# public" assert st("private:") == "# private" + #iterator declaration + assert st("std::vector<int>::iterator i;") == "" # TODO: Handle the existing ones with Python equivalents # assert st("std::...") |
