summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-11-25 20:41:39 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-11-26 17:35:39 +0100
commit92cec7af3ee88673d58e70e5b9a84a0cf55aa734 (patch)
tree76188f325774337655dab3400c37bef44e4f646e /tests
parentb45ebeece5ee63a94b4ac3c10347e2e14e1fa311 (diff)
downloadqtwebsockets-92cec7af3ee88673d58e70e5b9a84a0cf55aa734.tar.gz
Cleanup QWebSocketFrame
Remove QWebSocketFrame assignment and move stuff by our own - the default ones are good. Also reorder the members to reduce the padding (56 to 48 bytes on 64bits). Change-Id: Ib4628628af924c36ad3cd9bf67ce72752ef97ff5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/websockets/websocketframe/tst_websocketframe.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/auto/websockets/websocketframe/tst_websocketframe.cpp b/tests/auto/websockets/websocketframe/tst_websocketframe.cpp
index 6b9aaaf..bbf0e5f 100644
--- a/tests/auto/websockets/websocketframe/tst_websocketframe.cpp
+++ b/tests/auto/websockets/websocketframe/tst_websocketframe.cpp
@@ -201,8 +201,8 @@ void tst_WebSocketFrame::tst_copyConstructorAndAssignment()
frame.readFrame(&buffer);
buffer.close();
+ auto compareFrames = [](const QWebSocketFrame &other, const QWebSocketFrame &frame)
{
- QWebSocketFrame other(frame);
QCOMPARE(other.closeCode(), frame.closeCode());
QCOMPARE(other.closeReason(), frame.closeReason());
QCOMPARE(other.hasMask(), frame.hasMask());
@@ -217,24 +217,20 @@ void tst_WebSocketFrame::tst_copyConstructorAndAssignment()
QCOMPARE(other.rsv1(), frame.rsv1());
QCOMPARE(other.rsv2(), frame.rsv2());
QCOMPARE(other.rsv3(), frame.rsv3());
+ };
+
+ {
+ QWebSocketFrame other(frame);
+ compareFrames(other, frame);
}
{
QWebSocketFrame other;
other = frame;
- QCOMPARE(other.closeCode(), frame.closeCode());
- QCOMPARE(other.closeReason(), frame.closeReason());
- QCOMPARE(other.hasMask(), frame.hasMask());
- QCOMPARE(other.isContinuationFrame(), frame.isContinuationFrame());
- QCOMPARE(other.isControlFrame(), frame.isControlFrame());
- QCOMPARE(other.isDataFrame(), frame.isDataFrame());
- QCOMPARE(other.isFinalFrame(), frame.isFinalFrame());
- QCOMPARE(other.isValid(), frame.isValid());
- QCOMPARE(other.mask(), frame.mask());
- QCOMPARE(other.opCode(), frame.opCode());
- QCOMPARE(other.payload(), frame.payload());
- QCOMPARE(other.rsv1(), frame.rsv1());
- QCOMPARE(other.rsv2(), frame.rsv2());
- QCOMPARE(other.rsv3(), frame.rsv3());
+ compareFrames(other, frame);
+ QWebSocketFrame other2 = std::move(other);
+ compareFrames(other2, frame);
+ QWebSocketFrame other3(std::move(other2));
+ compareFrames(other3, frame);
}
}