From 38e7fcefdc131c0aaae72a229c759fb1428f0f57 Mon Sep 17 00:00:00 2001 From: faithwang Date: Sun, 27 Mar 2022 16:32:17 +0800 Subject: [PATCH] delete useless code Signed-off-by: faithwang --- .../distributed/DistributedDataPane.java | 49 ---------------- .../component/DistributedTimeShaft.java | 1 - .../applicationtrace/AppTracePanelTest.java | 8 +-- .../DistributedDataStatisticsPaneTest.java | 4 +- .../distributed/DistributedPanelTest.java | 7 +-- .../trace/component/AnalystPanelTest.java | 6 +- .../views/trace/component/TabPanelTest.java | 57 ------------------- 7 files changed, 4 insertions(+), 128 deletions(-) delete mode 100644 host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/TabPanelTest.java diff --git a/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/DistributedDataPane.java b/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/DistributedDataPane.java index 1d2886fb9..693d006b5 100644 --- a/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/DistributedDataPane.java +++ b/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/DistributedDataPane.java @@ -119,58 +119,12 @@ public class DistributedDataPane extends JBPanel { private class MyTabPanel extends JBTabbedPane implements MouseListener { private Rectangle setting = new Rectangle(); private Rectangle cancel = new Rectangle(); - // private Point startPoint; - // private Point endPoint; - // private Rectangle srcBounds; /** * MyTabPanel */ public MyTabPanel() { addMouseListener(this); - // addMouseMotionListener(new MouseMotionListener() { - // @Override - // public void mouseDragged(MouseEvent event) { - // if (getCursor().getType() == Cursor.N_RESIZE_CURSOR) { - // endPoint = SwingUtilities.convertPoint(MyTabPanel.this, event.getPoint(), - // MyTabPanel.this.getRootPane().getLayeredPane()); - // int yPosition = Utils.getY(endPoint) - Utils.getY(startPoint); - // if (srcBounds.height - yPosition < barHeight) { - // return; - // } else if (srcBounds.height - yPosition - // > MyTabPanel.this.getRootPane().getLayeredPane().getHeight() - barHeight) { - // return; - // } else { - // DistributedDataPane.this.setBounds(Utils.getX(srcBounds), - // Utils.getY(srcBounds) + yPosition, - // srcBounds.width, - // srcBounds.height - yPosition); - // DistributedDataPane.this.revalidate(); - // if (boundsChangeListener != null) { - // boundsChangeListener.consume(DistributedDataPane.this.getBounds()); - // } - // } - // } - // } - // - // @Override - // public void mouseMoved(MouseEvent event) { - // int xNum = 0; - // if (getTabCount() > 0) { - // Rectangle rect = getUI().getTabBounds(MyTabPanel.this, getTabCount() - 1); - // xNum = rect.width + Utils.getX(rect) + 10; - // } - // if (event.getY() > 0 && event.getY() < barHeight && event.getX() > xNum) { - // if (setting.contains(event.getPoint()) || cancel.contains(event.getPoint())) { - // setCursor(new Cursor(Cursor.HAND_CURSOR)); - // } else { - // setCursor(new Cursor(Cursor.N_RESIZE_CURSOR)); - // } - // } else { - // setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - // } - // } - // }); } @Override @@ -207,9 +161,6 @@ public class DistributedDataPane extends JBPanel { @Override public void mousePressed(MouseEvent event) { - // srcBounds = DistributedDataPane.this.getBounds() - // startPoint = SwingUtilities - // .convertPoint(MyTabPanel.this, event.getPoint(), MyTabPanel.this.getRootPane().getLayeredPane()) } @Override diff --git a/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/component/DistributedTimeShaft.java b/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/component/DistributedTimeShaft.java index f0d9f33e5..4df6bbf4b 100644 --- a/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/component/DistributedTimeShaft.java +++ b/host/ohosprofiler/src/main/java/ohos/devtools/views/distributed/component/DistributedTimeShaft.java @@ -395,7 +395,6 @@ public class DistributedTimeShaft extends JBPanel implements KeyListener, MouseL g2.fillRect(0, 0, getWidth(), getHeight()); g2.setComposite(alpha100); g2.setColor(JBColor.foreground()); - // g2.drawString("CPU Usage", 3, 13); g2.setComposite(alpha100); if (startX == 0 && endX == 0) { startX = 0; diff --git a/host/ohosprofiler/src/test/java/ohos/devtools/views/applicationtrace/AppTracePanelTest.java b/host/ohosprofiler/src/test/java/ohos/devtools/views/applicationtrace/AppTracePanelTest.java index e8d4c1add..b0ceffdb7 100644 --- a/host/ohosprofiler/src/test/java/ohos/devtools/views/applicationtrace/AppTracePanelTest.java +++ b/host/ohosprofiler/src/test/java/ohos/devtools/views/applicationtrace/AppTracePanelTest.java @@ -73,12 +73,6 @@ class AppTracePanelTest { delay(10000); mouseClick(317, 373); select(494, 367, 584, 467); - // select(419, 369, 500, 469); - // mouseClick(1290, 96); - // mouseClick(315, 535); - // mouseClick(1290, 96); - // mouseClick(52, 437); - // mouseClick(1386, 97); delay(); } @@ -122,4 +116,4 @@ class AppTracePanelTest { robot.delay(1000); } } -} \ No newline at end of file +} diff --git a/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedDataStatisticsPaneTest.java b/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedDataStatisticsPaneTest.java index 461f20375..d29e7bee4 100644 --- a/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedDataStatisticsPaneTest.java +++ b/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedDataStatisticsPaneTest.java @@ -68,7 +68,6 @@ class DistributedDataStatisticsPaneTest { frame = new FrameFixture(jFrame); frame.show(new Dimension(1024, 600)); frame.moveTo(new Point(0, 0)); - // inspect(); } @AfterEach @@ -100,7 +99,6 @@ class DistributedDataStatisticsPaneTest { mouseClick(312, 64); mouseClick(290, 158); mouseClick(390, 68); - // inspect(); delay(); } @@ -140,4 +138,4 @@ class DistributedDataStatisticsPaneTest { robot.delay(1000); } } -} \ No newline at end of file +} diff --git a/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedPanelTest.java b/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedPanelTest.java index cda542cdc..03000fde8 100644 --- a/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedPanelTest.java +++ b/host/ohosprofiler/src/test/java/ohos/devtools/views/distributed/DistributedPanelTest.java @@ -80,7 +80,6 @@ class DistributedPanelTest { .setOffsetB(186590530788000L) .build()); panel.updateUI(); - // inspect(); delay(10000); select(280, 90, 285, 90); // 测试选择时间区间 keyClick(KeyEvent.VK_W); // 测试 wsad 缩放 @@ -88,10 +87,6 @@ class DistributedPanelTest { keyClick(KeyEvent.VK_A); keyClick(KeyEvent.VK_D); mouseClick(23, 234); // 展开thread - // mouseClick(43, 234);//选中thread - // select(300, 234,400, 236);//选中thread范围 - // mouseClick(300, 234);//取消选中thread - // mouseClick(430, 234);//点击func delay(); } @@ -135,4 +130,4 @@ class DistributedPanelTest { robot.delay(1000); } } -} \ No newline at end of file +} diff --git a/host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/AnalystPanelTest.java b/host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/AnalystPanelTest.java index b9b6dddf8..305d1b722 100644 --- a/host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/AnalystPanelTest.java +++ b/host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/AnalystPanelTest.java @@ -630,7 +630,6 @@ class AnalystPanelTest { AnalystPanel analystPanel = new AnalystPanel(); JFrame jbPanel = new JFrame(); jbPanel.add(analystPanel); - // AnalystPanel.layeredPane = jbPanel.getLayeredPane(); FlagBean flagBean = new FlagBean(); flagBean.setColor(Color.BLACK); flagBean.setTime(1L); @@ -643,7 +642,6 @@ class AnalystPanelTest { AnalystPanel analystPanel = new AnalystPanel(); JFrame jbPanel = new JFrame(); jbPanel.add(analystPanel); - // AnalystPanel.layeredPane = jbPanel.getLayeredPane(); FlagBean flagBean = new FlagBean(); flagBean.setColor(Color.BLACK); flagBean.setTime(0L); @@ -668,7 +666,6 @@ class AnalystPanelTest { AnalystPanel analystPanel = new AnalystPanel(); JFrame jbPanel = new JFrame(); jbPanel.add(analystPanel); - // AnalystPanel.layeredPane = jbPanel.getLayeredPane(); FlagBean flagBean = new FlagBean(); flagBean.setColor(Color.BLACK); flagBean.setTime(-1000L); @@ -681,11 +678,10 @@ class AnalystPanelTest { AnalystPanel analystPanel = new AnalystPanel(); JFrame jbPanel = new JFrame(); jbPanel.add(analystPanel); - // AnalystPanel.layeredPane = jbPanel.getLayeredPane(); FlagBean flagBean = new FlagBean(); flagBean.setColor(Color.BLACK); flagBean.setTime(Long.MAX_VALUE); analystPanel.clickTimeFlag(flagBean); assertNotNull(flagBean); } -} \ No newline at end of file +} diff --git a/host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/TabPanelTest.java b/host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/TabPanelTest.java deleted file mode 100644 index a31b5bb18..000000000 --- a/host/ohosprofiler/src/test/java/ohos/devtools/views/trace/component/TabPanelTest.java +++ /dev/null @@ -1,57 +0,0 @@ -// /* -// * Copyright (c) 2021 Huawei Device Co., Ltd. -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// */ -// -// package ohos.devtools.views.trace.component; -// -// import org.junit.jupiter.api.Test; -// -// import java.awt.event.MouseEvent; -// -// /** -// * test TabPanel class . -// * -// * @version 1.0 -// * @date 2021/4/24 18:03 -// **/ -// class TabPanelTest { -// /** -// * test function the mouseDragged . -// */ -// @Test -// void mouseDragged() { -// TabPanel tabPanel = new TabPanel(); -// MouseEvent mouseEvent = new MouseEvent(tabPanel, 1, 1, 1, 1, 1, 1, true, 1); -// tabPanel.mouseDragged(mouseEvent); -// } -// -// /** -// * test function the mouseMoved . -// */ -// @Test -// void mouseMoved() { -// TabPanel tabPanel = new TabPanel(); -// MouseEvent mouseEvent = new MouseEvent(tabPanel, 1, 1, 1, 1, 1, 1, true, 1); -// tabPanel.mouseMoved(mouseEvent); -// } -// -// /** -// * test function the hideInBottom . -// */ -// @Test -// void hideInBottom() { -// TabPanel tabPanel = new TabPanel(); -// tabPanel.hideInBottom(); -// } -// } \ No newline at end of file